Skip to content

Instantly share code, notes, and snippets.

@jacksoncage
Last active Dec 26, 2015
Embed
What would you like to do?
Script to stop/start a play framework application.
#!/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