Skip to content

Instantly share code, notes, and snippets.

@farcaller
Created December 29, 2009 08:07
Show Gist options
  • Select an option

  • Save farcaller/265210 to your computer and use it in GitHub Desktop.

Select an option

Save farcaller/265210 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Wrapper for running Tomcat under launchd
# Required because launchd needs a non-daemonizing process
function shutdown()
{
$CATALINA_HOME/bin/shutdown.sh
/bin/rm $CATALINA_PID
}
function wait_for_death()
{
while /bin/kill -0 $1 2> /dev/null ; do
sleep 2
done
}
export CATALINA_PID=$CATALINA_HOME/logs/tomcat.pid
$CATALINA_HOME/bin/startup.sh
trap shutdown QUIT ABRT KILL ALRM TERM TSTP
sleep 2
wait_for_death `cat $CATALINA_PID`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment