#!/bin/bashexport OPENFIRE_HOME=/usr/local/openfireexport JAVA_HOME=/Library/Java/Homefunction shutdown(){date echo"Shutting down Openfire"kill-s TERM `ps auxww | grep-v wrapper | awk'/openfire/ && !/awk/ {print $2}'`}dateecho"Starting Openfire"/usr/bin/java -server-jar"$OPENFIRE_HOME/lib/startup.jar"-Dopenfire.lib.dir=/usr/local/openfire/lib&OPENFIRE_PID=`ps auxww | grep-v wrapper | awk'/openfire/ && !/awk/ {print $2}'`# allow any signal which would kill a process to stop Openfiretrap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTPecho"Waiting for `cat$OPENFIRE_PID`"wait`cat$OPENFIRE_PID`