activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amerigo5 <ameri...@hotmail.com>
Subject Re: ActiveMQ as Service in Linux
Date Fri, 26 May 2006 18:42:07 GMT

Below are steps to make ActiveMQ a Linux Daemon on Red Hat 4 ES.

It's based on
http://www-128.ibm.com/developerworks/java/library/l-secjav.html

------------------------------------------------------------------------------------------------
Settings:

 - JAVA_HOME=/opt/java/jdk1.5.0_06 

 - ActiveMQ?=/opt/activemq/incubator-activemq-4.0
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Installation
------------------------------------------------------------------------------------------------
Sun Java JDK

1. Install Sun Java JDK on /opt/java/ directory.

2. Create a shortcut to JDK directory:

# sudo ln -s /opt/java/jdk1.5.0_06 /opt/java/java
------------------------------------------------------------------------------------------------
ActiveMQ

1. Install ActiveMQ on /opt/activemq/ directory.

2. Make ActiveMQ startup and shutdown scripts executable:

# sudo chmod +x /opt/activemq/incubator-activemq-4.0/bin/activemq
# sudo chmod +x /opt/activemq/incubator-activemq-4.0/bin/shutdown
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
ActiveMQ as Linux Daemon

1. Create activemq user:

# sudo /usr/sbin/useradd activemq

2. Create ActiveMQ startup script /home/activemq/activemqstart.sh with the
following content:

#!/bin/bash
export JDK_HOME=/opt/java/java
export JAVA_HOME=/opt/java/java
/opt/activemq/incubator-activemq-4.0/bin/activemq &

3. Make /home/activemq/activemqstart.sh executable:

# sudo chmod +x /home/activemq/activemqstart.sh

4. Create ActiveMQ shutdown script /home/activemq/activemqstop.sh with the
following content:

#!/bin/bash
export JDK_HOME=/opt/java/java
export JAVA_HOME=/opt/java/java
/opt/activemq/incubator-activemq-4.0/bin/shutdown

5. Make /home/activemq/activemqstop.sh executable:

# sudo chmod +x /home/activemq/activemqstop.sh

6. 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 0

RETVAL=0

umask 077

start() {
        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 1
esac

exit $?

7. Enable ActiveMQ service configuration as Linux Daemon:

# sudo chmod +x /etc/init.d/activemq
# sudo /sbin/chkconfig --add activemq
# sudo /sbin/chkconfig activemq on

8. Restart the server.
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Note:  activemq-data is being created in "/" root directory.  I have to
explicitly set the activemq-data location in activemq.conf
------------------------------------------------------------------------------------------------
--
View this message in context: http://www.nabble.com/ActiveMQ+as+Service+in+Linux-t1608673.html#a4581699
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message