I faxed a contributor agreement and enrolled in the issue tracker, but I couldn’'t see how to open a ticket and attach this patch.
Below is a patch that fixes a number of issues – referring to a nonexistant openfire.sh, missing ‘‘start’’ argument to openfire, typo in a variable name, and failing to capture the PID – which precluded the init script from working.
This patch was created on Fedora 5 using rpm version openfire-3.3.0-1.
--- openfired 2007-04-13 13:59:12.000000000 -0700 +++ /etc/init.d/openfired 2007-04-25 08:16:08.000000000 -0700 @@ -9,12 +9,12 @@ # config: /etc/sysconfig/openfire # pidfile: /var/run/openfire.pid # -# This script has currently been tested on Redhat and CentOS based systems, +# This script has currently been tested on Redhat, Fedora, and CentOS based systems, # but should theoretically work on most UNIX like systems # -# Before running this script make sure $OPENFIRE_HOME/bin/openfire.sh is +# Before running this script make sure $OPENFIRE_HOME/bin/openfire is # executable by the user you want to run openfire as -# (chmod +x $OPENFIRE_HOME/bin/openfire.sh) +# (chmod +x $OPENFIRE_HOME/bin/openfire) # # This script should be copied into /etc/init.d and linked into # your default runlevel directory. @@ -22,8 +22,10 @@ # grep default /etc/inittab # # Link to the directory like follows -# cd /etc/rc<num>.d -# ln -s ../init.d/openfired S99openfired +# cd /etc/rc<num>.d +# ln -s ../init.d/openfired S99openfired +# Or +# chkconfig --add openfired # PATH=/sbin:/bin:/usr/bin:/usr/sbin @@ -59,7 +61,7 @@ [ -z "$OPENFIRE_LOGDIR" ] && OPENFIRE_LOGDIR=$OPENFIRE_HOME/logs -OPENFIRE_CMD="$OPENFIRE_HOME/bin/openfire.sh" +OPENFIRE_CMD="$OPENFIRE_HOME/bin/openfire" [ -f "$OPENFIRE_CMD" ] || exit 1 start() { @@ -69,14 +71,16 @@ # Start daemons. echo -n "Starting $PROG: " - su -s /bin/sh -c "$OPENFIRE_CMD" $OPENFIRE_USER > nohup.out 2>&1 & + su -s /bin/sh -c "$OPENFIRE_CMD start" $OPENFIRE_USER > nohup.out 2>&1 & RETVAL=$? if [ $RETVAL -eq 0 -a ! -z "$OPENFIRE_PIDFILE" ]; then - echo $! > $OPENFIRE_PIDFILE + sleep 1 # wait for java to fire up. pgrep fails otherwise + pid=`pgrep -u $OPENFIRE_USER java` + echo $pid > $OPENFIRE_PIDFILE fi - echo + echo $pid [ $RETVAL -eq 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/$PROG @@ -88,7 +92,7 @@ # Stop daemons. echo -n "Shutting down $PROG: " - [ -f "$OPENFILE_PIDFILE" ] && kill `cat $OPENFIRE_PIDFILE` + [ -f "$OPENFIRE_PIDFILE" ] && kill `cat $OPENFIRE_PIDFILE` RETVAL=$? echo