OF startup script for Solaris 10 and install notes

Starting with the linux startup script I modified it for Solaris. Note the short comments on the example installation for Solaris including a short .profile for the jive user. I grabbed the latest java 1.6.0_16-b01 and unpacked it under /opt/java (not a symlink to the jre path but a real dir with the bits under it as to avoid making changes to the bin/openfire startup script). I’m using an old SunOne directory server v5.2 for LDAP. Works ok though the group thing is a bit weird - haven’t worked out those kinks yet. BIG HINT™ if you brick your server by playing with the ldap properties and can’t log in, change the true in ./conf/openfire.xml to false and restart the server… and try again until you get your filters correct.

EDIT1: I’ve added two dns entries for the server - using the same IP: xmpp.blah.com and conference.xmpp.blah.com (both are A records to the same IP). This seemed to stop the DNS errors I was seeing in the logs. I gleaned this from a few other posts.

#!/bin/sh

openfired stops and starts the openfire XMPP service on Solaris 10

This script should be copied into /etc/init.d and linked into

your default runlevel directory.

EX: ln -s /etc/init.d/openfired /etc/rc3.d/S99openfired

Dependencies (Solaris install example):

Add a locked user/group with /bin/sh as shell: jive

jive’s home is /opt/jive

Unpack/install openfire under /opt/jive/openfire (must be a subdir of the home dir)

chown -R jive:jive /opt/jive

Set the following variables

Set this to tell this script where openfire lives

If this is not set the script will look for /opt/openfire, then /usr/local/openfire

OPENFIRE_HOME=/opt/jive/openfire
export OPENFIRE_HOME

If there is a different user you would like to run this script as,

change the following line

OPENFIRE_USER=jive
export OPENFIRE_USER

Put this in jive’s ~/.profile to point to the JVM you want to use

#INSTALL4J_JAVA_HOME_OVERRIDE=/opt/java
#export INSTALL4J_JAVA_HOME_OVERRIDE

-----------------------------------------------------------------

If a openfire home variable has not been specified, try to determine it

if [ -z “$OPENFIRE_HOME” ]; then
if [ -d “/opt/openfire” ]; then
OPENFIRE_HOME="/opt/openfire"
elif [ -d “/usr/local/openfire” ]; then
OPENFIRE_HOME="/usr/local/openfire"
else
echo "Could not find Openfire installation under /opt or /usr/local"
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME"
exit 1
fi
fi

execCommand () {
OLD_PWD=pwd
CMD="./openfire $1"
/bin/su - $OPENFIRE_USER -c “(cd $OPENFIRE_HOME/bin; $CMD)” &
sleep 1 # allows prompt to return
cd $OLD_PWD
}

start () {
execCommand “start”
}

stop () {
execCommand “stop”
}

case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10 # since stop is backgrounded
start
;;
status)
#retval=$(pgrep -u $OPENFIRE_USER -f $OPENFIRE_HOME/bin/openfire > /dev/null ; echo $?)
pgrep -u $OPENFIRE_USER -f $OPENFIRE_HOME/bin/openfire > /dev/null
retval=$?
if [ “$retval” = “0” ] ; then
echo "openfire is running"
exit 0
else
echo "openfire is not running"
exit 0
fi
;;
*)
echo "Usage $0 {start|stop|restart|status}"
exit 1
esac

exit 0