- A+
所属分类:Linux
系统环境:Centos 7 软件版本:5.14.5 1.下载 [root@localhost /opt]# wget http://archive.apache.org/dist/activemq/5.14.5/apache-activemq-5.14.5-bin.tar.gz [root@localhost /opt]# tar zxvf apache-activemq-5.14.5-bin.tar.gz [root@localhost /opt]# mv apache-activemq-5.14.5 activemq 2.创建启动脚本 [root@localhost /opt]# vim /etc/init.d/activemq #!/bin/bash # #chkconfig: 2345 30 70 #description: Start and stops activemq #定义命令 CMD=/opt/activemq/bin/activemq start() { $CMD start echo "Activemq is started..." } stop() { $CMD stop echo "Activemq is stopped" } status() { $CMD status echo "Activemq is running..." } restart() { $CMD restart echo "Activemq is restarted" } case "$1" in start) start ;; stop) stop ;; status) status ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|status|restart}" esac 3.添加权限 [root@localhost /opt]# chmod +x /etc/init.d/activemq 4.开机启动 [root@localhost /opt]# echo /etc/init.d/activemq start >> /etc/rc.d/rc.local