您的位置:首页 > 运维架构 > Linux

Linux下ActiveMQ自启动

2017-02-09 20:55 281 查看
1、在root权限下操作

2、cp /usr/local/activemq/bin/activemq /etc/init.d

3、cd /etc/init.d/

4、vi activemq

5、在第二行添加

#### BEGIN INIT INFO
# Provides:             activemq
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:         0 6
# chkconfig: 2345 64 36
# Short-Description:    ActiveMQ server
### END INIT INFO


6、在最后一个#后添加

export JAVA_HOME=/usr/local/jdk7

ACTIVEMQ_HOME=/usr/local/activemq




7、chmod +x activemq

8、chkconfig --add activemq

9、chkconfig --list 显示该服务则成功



---------------------------------------------------------------------------------------------

在Ubuntu中,有可能没有chkconfig命令或者执行失败,可以用Ubuntu的update-rc.d命令替换

问题

cp 到/etc/init.d目录下的时候,有时候启动会提示找不到路径等等问题,但是在安装目录启动就可以,所以可以通过软连接来实现启动脚本:

ln -s /usr/local/activemq/bin/activemq /etc/init.d/

vi /etc/init.d/activemq

---------------------------------------------

# 第二行插入

# chkconfig: 345 63 37

# description: Auto start ActiveMQ

---------------------------------------------

然后就可以添加开机启动了

chkconfig activemq on

chkconfig --list activemq

也可以正常用服务的命令启动和停止

service activemq start

service activemq status

service activemq stop
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: