-
-
Save Rykian/5533035 to your computer and use it in GitHub Desktop.
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 -e | |
# chkconfig: 345 99 1 | |
# description: Tomcat6 service | |
# processname: java | |
# Get LSB functions | |
. /lib/lsb/init-functions | |
export JAVA_HOME=/usr | |
export TOMCAT_USER=solr | |
export CATALINA_HOME=/opt/tomcat6 | |
export CATALINA_PID=$CATALINA_HOME/bin/tomcat6.pid | |
[ -d "$CATALINA_HOME" ] || { echo "Tomcat requires $CATALINA_HOME."; exit 1; } | |
case $1 in | |
start|stop|run) | |
if su $TOMCAT_USER bash -c "$CATALINA_HOME/bin/catalina.sh $1"; then | |
log_success_msg "Tomcat $1 successful" | |
else | |
log_failure_msg "Error in Tomcat $1: $?" | |
fi | |
;; | |
restart) | |
$0 start | |
$0 stop | |
;; | |
status) | |
if [ -f "$CATALINA_PID" ]; then | |
read kpid < "$CATALINA_PID" | |
if ps --pid $kpid 2>&1 1>/dev/null; then | |
echo "$0 is already running at ${kpid}" | |
else | |
echo "$CATALINA_PID found, but $kpid is not running" | |
fi | |
unset kpid | |
else | |
echo "$0 is stopped" | |
fi | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment