Go up: WikiStart
A.8. Automatic Startup and Shutdown Using an RC Script
SysV initialization scripts and process controls provide one method of automatically starting and stopping Jabberd 2 when the machine comes up and goes down. This appendix describes how to implement SysV control for Jabberd on the Fedora 1.0 platform. To modify this process for your own distro, please consult your Linux or Unix documentation.
A.8.1. Download RC Script
An RC script for Jabberd 2 currently exists in the tools directory of the Jabberd 2 CVS Repository. Download the file jabberd.rc from CVS and copy it to the /etc/rc.d/init.d directory.
A.8.2. Rename RC Script
Rename the downloaded file to 'jabberd2':
mv -f /etc/rc.d/init.d/jabberd.rc /etc/rc.d/init.d/jabberd2
A.8.3. Assign Ownership and Permissions
The RC script file should be executable and owned by root:
chown -f root:root /etc/rc.d/init.d/jabberd2
chmod -f 0755 /etc/rc.d/init.d/jabberd2
A.8.4. Create Symbolic Links
You should create start and kill symbolic links in all appropriate run level directories:
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc0.d/K15jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc1.d/K15jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc2.d/S85jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc2.d/K15jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc3.d/S85jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc3.d/K15jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc4.d/S85jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc4.d/K15jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc5.d/S85jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc5.d/K15jabberd2
ln -s /etc/rc.d/init.d/jabberd2 /etc/rc.d/rc6.d/K15jabberd2
A.8.5. Restart Jabberd 2
You should now be able to test your RC script:
/etc/rc.d/init.d/jabberd2 restart
/etc/rc.d/init.d/jabberd2 restart
The second invocation of restart should all result in [ OK ]. Note that if you execute redhat-config-services from the Fedora gui or execute ntsysv from a Fedora terminal or console session, you will now find jabberd2 in the list of services.
I Important: Script Runs as Root The script, as included in the Jabberd 2 Distribution, runs as Jabberd 2 as root. A workaround for this issue is to modify the RC script so that the starting user (usually root) is su to the jabber user. Change line 125 of the script to read:
su - jabber -c "${progsPath}/${prog} ${args} & 2> /dev/null"
© 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.