[ejabberd] ejabberd under runit (process supervision)

Arjen Meek arjen at xyx.nl
Mon Apr 18 02:10:53 MSD 2005


I just replaced jabberd 1.4 with ejabberd on my Debian-based server.
Everything seems to be running fine, setting it up to authorize against
LDAP and importing my /var/lib/jabber was a breeze. However, there's a
slight problem arising from the fact that a SIGTERM to the parent
process seems to kill the server in a way that prevents it from properly
closing its open files.

I use runit, a daemontools-like process supervision system that's in
Debian to run ejabberd, this is my /etc/ejabberd/run :

exec 2>&1
exec chpst -u ejabberd ejabberd -noshell --log /dev/stdout

(no "-detached" so it will run in the foreground, chpst -u ejabberd
sets the user&group to "ejabberd")

ejabberd starts fine and functions correctly as far as I can see, and
logging to stdout seems to work as well. When I tell runit (through
runsvctrl) to stop ejabberd, causing it to send it a SIGTERM, and
start it again, this appears in the log:

2005-04-17_20:58:34.54840 dets: file "/var/lib/ejabberd/offline_msg.DAT"
 not properly closed, repairing ...

Is there any "clean" way to have ejabberd properly shut down on a
SIGTERM? I could write a wrapper script to trap signals and run
ejabberdctl as required, but I'd rather avoid such complexity.

If not, what do I risk by leaving it like this and just letting ejabberd
be killed in this way whenever I need to stop it?
I'm only using ejabberd on a very small scale btw, running a single node
and serving ~10 users.


More information about the ejabberd mailing list