CentOS7 下 ActiveMQ 开机启动

尝试了很多种方法,最终使用自己编写脚本,启动 activemq

#!/bin/sh
#
# /etc/init.d/activemq
# chkconfig: 345 63 37
# description: activemq servlet container.
# processname: activemq 5.15.2


# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network


export JAVA_HOME=/usr/java/jdk1.8.0_144
export CATALINA_HOME=/root/apache-activemq-5.15.2


case $1 in
    start)
        sh $CATALINA_HOME/bin/activemq start
    ;;
    stop)
        sh $CATALINA_HOME/bin/activemq stop
    ;;
    restart)
        sh $CATALINA_HOME/bin/activemq stop
        sleep 1
        sh $CATALINA_HOME/bin/activemq start
    ;;
    status)
        sh $CATALINA_HOME/bin/activemq status
    ;;
esac
exit 0

设置文件权限:chmod 777 activemq

添加到服务:chkconfig --add activemq

服务自启动:chkconfig activemq on

服务启动/停止/重启命令:service activemq start/stop/restart

猜你喜欢

转载自blog.csdn.net/zxcvqwer19900720/article/details/79129053