Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added CategoryFAQ link

...

No Format
#!/bin/sh
#
# /Library/StartupItems/Tomcat/Tomcat
#
# A script to automatically start up Tomcat on system bootup
# for Mac OS X. This is actually just a wrapper script around
# the standard catalina.sh script, which is included in
# the distribution.
#

# Suppress the annoying "$1: unbound variable" error when no option
# was given
if [ -z $1 ] ; then
	echo "Usage: $0 [start|stop|restart] "
	exit 1
fi

# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1
. /etc/rc.common

# The path to the catalina.sh script. 
# The currently used version is in /Library/Tomcat/Home/bin
SCRIPT="/Library/Tomcat/Home/bin/catalina.sh"

# file to hold the process ID on start so it can be killed by stop.
export CATALINA_PID="/Library/Tomcat/Home/server.pid"

StartService ()
{
	if [ "${TOMCAT:=-NO-}" = "-YES-" ] ; then
		ConsoleMessage "Starting Tomcat server"
		$SCRIPT start > /dev/null 2>&1
	fi
}

StopService ()
{
	ConsoleMessage "Stopping Tomcat server"
	$SCRIPT stop -force > /dev/null 2>&1
}

RestartService ()
{
	ConsoleMessage "Restarting Tomcat server"
	StopService
	StartService
}

if test -x $SCRIPT ; then
	RunService "$1"
else
	ConsoleMessage "Could not find Tomcat control script!"
fi

...

CategoryFAQ