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
製做軟鏈接java
ln -s /etc/init.d/activemq /etc/rc3.d/$01activemq
或者用開機自啓動命令chkconfigtomcat
chkconfig activemq on