Linux下ActiveMQ自启动

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

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值