编辑服务文件

vi /etc/init.d/activemq

文件内容如下

#!/bin/bash
# chkconfig: 2345 10 90 
# description: activemq ....
prog=tomcat
JAVA_HOME=/usr/local/java/jdk1.7.0_25
export JAVA_HOME
CATALANA_HOME=/home/activemq
export CATALINA_HOME 
case "$1" in
start)
    echo "Starting $prog..."
    $CATALANA_HOME/bin/activemq start
    ;; 
stop)
   echo "Stopping $prog..."
    $CATALANA_HOME/bin/activemq stop
    ;; 
restart)
    echo "Stopping $prog..."
    $CATALANA_HOME/bin/activemq stop
    sleep 2
    echo
    echo "Starting $prog..."
    $CATALANA_HOME/bin/activemq start
    ;; 
*)
    echo "Usage: $prog {start|stop|restart}"
    ;;
esac
exit 

给予权限

chmod +x activemq

*设置开机自启动

制作软连接

ln -s /etc/init.d/activemq    /etc/rc3.d/$01activemq

或者用开机自启动命令chkconfig

chkconfig activemq on

 

posted on 2019-06-13 09:48  遥-ZHZ  阅读(2074)  评论(0编辑  收藏  举报