[JDEV] Starting the Server Automatically In SUN Solaris.

kadokev at msg.net kadokev at msg.net
Thu Mar 15 10:42:23 CST 2001


Can this be added to the FAQ?

> 	I  installed the JABBER Server in SUN Solaris system.
> 	I am using it regularly.
> 	But each day , i need to restart the server because I am starting it
> using telnet at the prompt and whenever I closes the telnet, the server is
> shutting down.
> 	Is There any way of restarting the server automatically and running
> it on and on and on continuously ................
> 
> 	I know there is way of starting these servers as a Demon Service .
> 	But I don't know more details about this thing.
> 
> 	Anyone can solve my problem???
 
There are a number of different ways to run 'jabberd' as a daemon. I use
Dan Bernstein's "daemontools" from  http://cr.yp.to/daemontools.html

Daemontools is a collection of tools for managing UNIX services, it is the
recommended method for running 'dnscache' and 'tinyDNS' (free BIND replacements)
and works well for just about any process that needs to always be up. It uses
a program called 'supervise' to automatically restart the process if it dies.


After installing daemontools, I add a rc script to run 'svscan' at boot,
and instruct svscan to supervise jabber with:

	ln -s /usr/local/jabber-1.4 /service/jabber


Finally, install the following script as /usr/local/jabber-1.4/run:

#! /bin/sh
#
# March 7, 2001. Kevin Kadow. Free to redistribute and modify
#
# Start up the core jabberd process.
# Requires 'daemontools' available at http://cr.yp.to/daemontools.html
#
PATH=$PATH:/usr/local/bin

cd /usr/local/jabber-1.4

su jabber -c "kill `cat ./spool/jabber.pid`; rm ./spool/jabber.pid"

exec setuidgid jabber jabberd/jabberd

###EOF###


For security, /usr/local/jabber-1.4 and the 'run' file should be owned by root,
with only /usr/loca/jabber-1.4/spool owned by the 'jabber' user:

	chown root /usr/local/jabber-1.4 /usr/local/jabber-1.4/run
	chown jabber /usr/local/jabber-1.4/spool


That's it. It seems complex, but once you get used to Dan's style, the benefits
of daemontools, dnscache, and qmail in security and speed are worth the effort.


Kevin




More information about the JDev mailing list