openfire-launchd-wrapper.sh 638 Bytes
Newer Older
1
#!/bin/bash
Gaston Dombiak's avatar
Gaston Dombiak committed
2
export OPENFIRE_HOME=/usr/local/openfire
3 4 5 6 7 8
export JAVA_HOME=/Library/Java/Home

function shutdown() 
{
	date
	echo "Shutting down Openfire"
Gaston Dombiak's avatar
Gaston Dombiak committed
9
    kill -s TERM `ps auxww | grep -v wrapper | awk '/openfire/ && !/awk/ {print $2}'`
10 11 12 13 14
}

date
echo "Starting Openfire"

Gaston Dombiak's avatar
Gaston Dombiak committed
15
/usr/bin/java -server -jar "$OPENFIRE_HOME/lib/startup.jar" -Dopenfire.lib.dir=/usr/local/openfire/lib&
16

Gaston Dombiak's avatar
Gaston Dombiak committed
17
OPENFIRE_PID=`ps auxww | grep -v wrapper | awk '/openfire/ && !/awk/ {print $2}'`
18 19 20 21 22 23

# allow any signal which would kill a process to stop Openfire
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP

echo "Waiting for `cat $OPENFIRE_PID`"
wait `cat $OPENFIRE_PID`