Last active
December 26, 2015 17:19
-
-
Save jacksoncage/7186636 to your computer and use it in GitHub Desktop.
Script to stop/start a play framework application.
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/sh | |
# | |
# play-run: Launch a play run instance on this node | |
# | |
# chkconfig: - 99 01 | |
# description: Enable this play application to run | |
# | |
PLAY_WORKDIR="/var/www/play" | |
PLAY_LOGDIR="/var/log/play" | |
PLAY_NODENAME="play" | |
NOW=$(date) | |
[ -x /usr/bin/java ] || exit 0 | |
start() | |
{ | |
cd $PLAY_WORKDIR | |
echo "" > $PLAY_LOGDIR/play.log | |
echo "$NOW" > $PLAY_LOGDIR/play.log | |
echo -n "$'\n' Starting Play Application on ($PLAY_NODENAME): " | |
sh -c "\ | |
play run >> $PLAY_LOGDIR/play.log 2>&1 &" | |
} | |
stop() | |
{ | |
echo -n "$'\n' Shutting down Play Application on ($PLAY_NODENAME): " | |
killall -9 sh | |
killall -9 java | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|reload) | |
stop | |
start | |
;; | |
status) | |
status java | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|reload}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment