Last active
August 29, 2015 14:07
-
-
Save Niemi/d53bb149cebfadb0ae2b to your computer and use it in GitHub Desktop.
tomcat init.d script [SysV] for SLES or OpenSuSe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#source "http://tr.opensuse.org/Tomcat_HOWTO" | |
# Tomcat Startup Script | |
### BEGIN INIT INFO | |
# Provides: Tomcat | |
# Required-Start: $local_fs $network $remote_fs apache2 | |
# Required-Stop: $local_fs $network $remote_fs apache2 | |
# Default-Start: 3 5 | |
# Default-Stop: 0 1 2 6 | |
# Short-Description: Tomcat | |
# Description: Tomcat | |
### END INIT INFO | |
CATALINA_HOME=/opt/tomcat; export CATALINA_HOME | |
JAVA_HOME=/usr/java/latest; export JAVA_HOME | |
TOMCAT_OWNER=tomcat; export TOMCAT_OWNER | |
RETVAL=0 | |
start() { | |
echo -n "Starting Tomcat: " | |
su -s /bin/bash $TOMCAT_OWNER $CATALINA_HOME/bin/startup.sh | |
sleep 2 | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat | |
echo | |
} | |
stop() { | |
echo -n "Stopping Tomcat: " | |
su -s /bin/bash $TOMCAT_OWNER $CATALINA_HOME/bin/shutdown.sh | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tomcat | |
echo | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo $"Usage: tomcat {start|stop|restart}" | |
exit | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment