Last active
August 29, 2015 14:27
-
-
Save patmandenver/be92a9eb4bd74df96928 to your computer and use it in GitHub Desktop.
Tomcat8 init script
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/bash | |
# | |
#Apache Tomcat8 init Script | |
# | |
##################################### | |
TOMCAT_HOME=/10x13/apps/tomcat8 | |
LOG_HOME=/10x13/logs/tomcat8 | |
PID_FOLDER=/var/run/tomcat8 | |
PID_FILE=$PID_FOLDER/tomcat.pid | |
start() { | |
echo -n "Starting Tomcat at $TOMCAT_HOME" | |
if [ ! -d $PID_FOLDER ]; then | |
mkdir $PID_FOLDER | |
chown tomcat:tomcat $PID_FOLDER | |
fi | |
su - tomcat -c "$TOMCAT_HOME/bin/startup.sh" | |
RETVAL=$? | |
} | |
stop() { | |
echo -n "Stopping Tomcat" | |
su - tomcat -c "$TOMCAT_HOME/bin/shutdown.sh -force" | |
RETVAL=$? | |
} | |
status() { | |
if [ -f $PID_FILE ]; then | |
PID=`cat $PID_FILE` | |
echo "Tomcat is running process Id: $PID" | |
else | |
echo "TOMCAT is not running" | |
fi | |
exit 0 | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
status) | |
status | |
;; | |
version) | |
$TOMCAT_HOME/bin/version.sh | |
RETVAL=$? | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status|version}" | |
exit 1 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment