Created
January 28, 2013 07:39
-
-
Save rkaneko/4653700 to your computer and use it in GitHub Desktop.
Daemon for jetty on CentOS .
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 | |
# | |
# chkconfig: 345 99 01 | |
# description: Startup script for the jetty | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
start() { | |
if [ -z `/usr/bin/pgrep -f "java -jar start.jar"` ]; then | |
echo "Starting jetty..." | |
cd /usr/local/jetty | |
java -jar start.jar & | |
else | |
echo "jetty is already running" | |
fi | |
} | |
stop() { | |
if [ ! -z `/usr/bin/pgrep -f "java -jar start.jar"` ]; then | |
echo "Stopping jetty..." | |
kill -9 `/usr/bin/pgrep -f "java -jar start.jar"` | |
echo "jetty stopped." | |
else | |
echo "jetty is not running" | |
fi | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment