Created
October 28, 2013 02:06
-
-
Save jglenn9k/7190369 to your computer and use it in GitHub Desktop.
Tomcat init script for CentOS 6.
This file contains hidden or 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 | |
# chkconfig: 234 20 80 | |
# description: Tomcat Server basic start/shutdown script | |
# processname: tomcat | |
# Pulled from http://www.rackspace.com/knowledge_center/article/centos-tomcat-6 | |
# Extra edits by James Glenn <[email protected]> | |
# See http://blog.ablackhat.net/2013/10/27/install-tomcat-on-centos/ | |
# This usually works for JAVA_HOME | |
JAVA_HOME=/usr/java/latest | |
export JAVA_HOME | |
TOMCAT_HOME=/opt/tomcat/bin | |
START_TOMCAT=/opt/tomcat/bin/startup.sh | |
STOP_TOMCAT=/opt/tomcat/bin/shutdown.sh | |
start() { | |
echo -n "Starting tomcat: " | |
cd $TOMCAT_HOME | |
sudo -u tomcat ${START_TOMCAT} | |
echo "done." | |
} | |
stop() { | |
echo -n "Shutting down tomcat: " | |
cd $TOMCAT_HOME | |
sudo -u tomcat ${STOP_TOMCAT} | |
echo "done." | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
sleep 10 | |
start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment