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/jdk7ACTIVEMQ_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
就爱阅读 www.92to.com 网友整理上传, 为您提供最全的知识大全, 期待您的分享,转载请注明出处。
来源: