Thats the way I do it:
I’m using the .tar.gz Version, not sure if this works with the RPM, too.
Basically I’m using the extra/openfired script shipped with Openfire. But this needs some modifications:
For some historical reasons the script calls openfire.sh, which does not exist in newer versions. Never mind, just create a symlink:
shell> cd /opt/openfire/bin
shell> ln -s openfire openfire.sh
Probably you want to set some VM parameters or use a custom JRE. Open the script openfire with your favorite editor and modify the variables to match your needs. For example:
INSTALL4J_ADD_VM_PARAMS="-Xms256m -Xmx256m"
INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.6.0_06
Now you need to modify the extra/openfired script. At first make it executable:
shell> cd /opt/openfire/bin/extra
shell> chmod u+x openfired
Modify the extra/openfired script with your favorite editor. Maybe you want to change the user which runs Openfire:
export OPENFIRE_USER=openfire
In order to get automatic startups/shutdowns to work, add the following as first line of function start():
touch /var/lock/subsys/openfired
Now you need a few more symlinks. Thats what it looks on my two systems:
[martin@jabber ~]$ ls -l /etc/init.d/openfired
lrwxrwxrwx 1 root root 33 Dec 9 13:51 /etc/init.d/openfired -> /opt/openfire/bin/extra/openfired
[martin@jabber ~]$ ls -l /etc/rc?.d/*openfired
lrwxrwxrwx 1 root root 19 Dec 9 13:51 /etc/rc0.d/K01openfired -> ../init.d/openfired
lrwxrwxrwx 1 root root 19 Dec 9 13:31 /etc/rc3.d/S70openfired -> ../init.d/openfired
lrwxrwxrwx 1 root root 19 Dec 9 13:43 /etc/rc6.d/K01openfired -> ../init.d/openfired
The directories /etc/rcX.d are used to start or stop applications in runlevel X. The scripts are called in alphabetically order. The first letter indicates if the application should be started (“S”) or killed (“K”). Your systems calls the linked script with parameter “start” to start an application. To stop an application it checks it the application is running (checks if /var/lock/subsys/openfired does exist) and calls the linked script with “stop”.
Make sure that for example your database or your network does startup before Openfire. Analogous it should be stopped after Openfire.