D.J. Bernstein's Daemontools provide another method of controlling Jabberd 2 through machine startup and shutdown. This appendix assumes that Daemontools are installed on your system. See How to Install Daemontools for installation instructions. See the Daemontools homepage for a description of Daemontools.
Daemontools configuration requires a run script in a dedicated directory. This directory is then symbolically linked to the /service directory for monitoring by the Svscan daemon of Daemontools. This how-to is a bit long because each of the Jabberd 2 binaries must have its own linked directory and run script. Additionally, the PID file writing should be disabled (in Jabberd XML configuration) for each of the binaries.
Create a master directory for the 5 Daemontools directories to be created below. The most convenient place for this directory is in /usr/local/etc/jabberd/. Create this new directory (as root):
mkdir /usr/local/etc/jabberd/daemontools
Create a sub-directory for each of the Jabberd binaries:
mkdir /usr/local/etc/jabberd/daemontools/router
mkdir /usr/local/etc/jabberd/daemontools/resolver
mkdir /usr/local/etc/jabberd/daemontools/sm
mkdir /usr/local/etc/jabberd/daemontools/c2s
mkdir /usr/local/etc/jabberd/daemontools/s2s
You should now have 5 sub-directories under /usr/local/etc/jabberd/daemontools/.
Each of the sub-directories now needs a run script for its respective Jabberd binary. Change to the router sub-directory to create your first run script:
cd /usr/local/etc/jabberd/daemontools/router
Using an editor, create a file called run in this directory. Edit the file as below so that it contains a run script for the router component:
#!/bin/sh
exec setuidgid jabber /usr/local/bin/router /usr/local/etc/jabberd/router.xml
Repeat this process for each of the remaining 4 sub-directories. You can use the above text as a template, and replace the 2 instances of router with the respective Jabberd binary (resolver, sm, c2s and s2s). For example, the run file in the resolver sub-directory should be created as below:
#!/bin/sh
exec setuidgid jabber /usr/local/bin/resolver /usr/local/etc/jabberd/resolver.xml
Each of the run scripts above needs to be executable. Run the command below to make each of the run scripts executable:
chmod 0755 /usr/local/etc/jabberd/daemontools/*/run
Svscan does not rely on PID files; therefore, PID file writing should be disabled in each of these configuration files:
router.xml
resolver.xml
sm.xml
c2s.xml
s2s.xml
Near the top of each of these files is a tag set for the PID file location. Comment these tags in each file above to disable PID file writing. For example, the top of router.xml should appear as below:
<!-- Router configuration -->
<router>
<!-- ID of the router on the network (default: router) -->
<id>router</id>
<!-- The process ID file. comment this out if you don't need to know
to know the process ID from outside the process (eg for control
scripts) -->
<!-- <pidfile>/usr/local/var/jabberd/pid/router.pid</pidfile> -->
Each of the sub-directories now needs to be linked to the /service/ directory. Once these symlinks are created, svscan will start and monitor the respective process.
Create 5 symlinks as below:
ln -s /usr/local/etc/jabberd/daemontools/router /service
ln -s /usr/local/etc/jabberd/daemontools/resolver /service
ln -s /usr/local/etc/jabberd/daemontools/sm /service
ln -s /usr/local/etc/jabberd/daemontools/c2s /service
ln -s /usr/local/etc/jabberd/daemontools/s2s /service
Make sure that the svscan daemon is running on your machine. On my distro (Gentoo Linux), the svscan daemon is started from /etc/init.d. You should now be able to check the status of your Jabberd services by using the svstat command. For example, to check the status of the router component, you would switch to the /service directory and then enter the svstat command as below:
svstat router
You should see output similar to this:
router: up (pid 20011) 248 seconds
Svscan will now monitor your Jabberd processes, and if a process goes down, Svscan will restart it.
© 2003 Will Kamishlian and Robert Norris
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
|
|
|
![]() |