powered by Jive Software

Running jive messenger as a daemon

how can i run jive messenger as a redhat9 daemon?

You will need to do the following as root. I haven’'t tested this myself but it should work.

you should probably create a user and group called messenger:

+/usr/sbin/groupadd messenger

/usr/sbin/useradd -d -g messenger messenger+

make sure you chown the messenger directory

chown -R messenger:messenger

make sure startup.sh is executable

chmod 770 /bin/startup.sh

you will need to create a init script in /etc/init.d.

For purposes of this post we will called jivemessengerd,

make sure you chmod 770 the script too.

the script will look something like this (beware not tested)

+#!/bin/sh

#warning i have not tested this script

. /etc/init.d/functions

export MESSENGER_HOME=

start() {

#execute server in the backgroun

su -c “nohup $MESSENGER_HOME/bin/startup.sh > $MESSENGER_HOME/nohup.out &” messenger

}

stop() {

#should kill only the messenger process

kill ps aux | grep java | grep messenger | awk ''{print $2}'' > /dev/null

}

restart() {

stop

start

}

case “$1” in

start)

start

;;

stop)

stop

;;

restart)

restart

;;

*)

echo “usage $0 {start|stop|restart}”

exit 1

;;

esac

exit 0

next, found out what your default runlevel is

grep default /etc/inittab

this will return a line like this.

id:3:initdefault:

next go in to the rc directory for the runlevel mentioned above:

cd /etc/rc.d

add a symlink:

link -s …/init.d/jivemessengerd S99jivemessengerd

The server should not startup on boot and you should be able to start and stop the server by using /etc/init.d/jivemessengerd script.

jet,

Please let us know if that worked for you!

I’'m interested on that as well.

Thank you,

– zgambitx

There is a script to run jive as a daemon now in CVS

under messenger/src/bin/extra

Andrew,

I tried the script manaully, it give me the error,

java.lang.ClassNotFoundException: org.jivesoftware.messenger.XMPPBootContainer

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at org.jivesoftware.messenger.starter.ServerStarter.start(ServerStarter.java:52)

at org.jivesoftware.messenger.starter.ServerStarter.main(ServerStarter.java:35)

Andrew,

I tried to use chkconfig, ntsysv, and GUI service utility to add the daemon to the boot list, but none of them could find jive-messengerd.

Any clue?

Thanks,

Jian

doh! i forgot to mention you need to create a new build of messenger from CVS to.

I also made some changes to ServerStarter class and startup.sh to allow the server to be started from other directories.

For more info view:

http://www.jivesoftware.org/forums/thread.jspa?threadID=13641

CVS build is broken at the moment though… should be fixed in a couple of days.

-Matt

I have never used any of the gui tools for adding a daemon, maybe you have to add hooks into script or something.

You will have to do this the old fashion way.

The following is also mentioned in the script itself:

  1. cp the script to the init.d directory (generally /etc/init.d or /etc/rc.d/init.d)

  2. find your default run level (cat /etc/inittab)

  3. cd into the directory of the default run level (ie cd /etc/rc5.d)

  4. create a start symlink (ln -s /etc/init.d/jive-messengerd S99jive-messengerd)

jive will start at the next boot

to test that everything workd properly (without rebooting):

/etc/rc5.d/jive-messengerd start

also make sure set the MESSENGER_HOME and MESSENGER_USER values in the script. It might be a good idea to set JAVA_HOME value in your script too, make sure it points to a 1.0 release!

I would also seriously consider running the app as a different user than root (always a good idea), you can accomplish this by doing the following (make sure MESSENGER_HOME points to the correct place):

groupadd messenger

useradd -d$MESSENGER_HOME -m -k /etc/skel -Gmessenger messenger

chown -R messenger:messenger $MESSENGER_HOME

If you want to make the init script work with the current release you could change the CMD variable in the start() function of the script too:

CMD=“cd $MESSENGER_HOME/bin; nohup ./startup.sh >> $MESSENGER_HOME/logs/nohup.out 2>&1 &”

This will allow ServerStarter class to find the libs in the place it is expecting (…/lib)