1. Configure the./activemq/bin/Linux/wrapper. conf file.
1) set the activemq path
2) set the JDK Java file path
2. Make activemq startup and shutdown scripts executable:
sudo chmod +x /opt/activemq/incubator-activemq-4.0/bin/activemqsudo chmod +x /opt/activemq/incubator-activemq-4.0/bin/shutdown
3. Create activemq User: sudo /usr/sbin/useradd activemq
4. Create activemq STARTUP script/home/activemq/activemqstart. Sh with
Following content:
#!/bin/bashexport JDK_HOME=/opt/java/javaexport JAVA_HOME=/opt/java/java/opt/activemq/incubator-activemq-4.0/bin/activemq &
5. Make/home/activemq/activemqstart. Sh executable:
sudo chmod +x /home/activemq/activemqstart.sh
6. Create activemq shutdown script/home/activemq/activemqstop. Sh with
Following content:
#!/bin/bash export JDK_HOME=/opt/java/java export JAVA_HOME=/opt/java/java /opt/activemq/incubator-activemq-4.0/bin/shutdown
7. Make/home/activemq/activemqstop. Sh executable:
sudo chmod +x /home/activemq/activemqstop.sh
8. Create activemq Linux service configuration script/etc/init. d/activemq
With the following content:
#!/bin/bash## activemq Starts ActiveMQ.### chkconfig: 345 88 12# description: ActiveMQ is a JMS Messaging Queue Server.### BEGIN INIT INFO# Provides: $activemq### END INIT INFO# Source function library.. /etc/init.d/functions[ -f /home/activemq/activemqstart.sh ] || exit 0[ -f /home/activemq/activemqstop.sh ] || exit 0RETVAL=0umask 077start() { echo -n $"Starting ActiveMQ: " daemon /home/activemq/activemqstart.sh echo return $RETVAL}stop() { echo -n $"Shutting down ActiveMQ: " daemon su -c /home/activemq/activemqstop.sh activemq echo return $RETVAL}restart() { stop start}case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1esacexit $?
9. Enable activemq service configuration as Linux daemon:
sudo chmod +x /etc/init.d/activemq sudo /sbin/chkconfig --add activemq sudo /sbin/chkconfig activemq on
10. Restart the server.
Service activemq restart
Original path: http://activemq.apache.org/unix-service.html