Created
February 16, 2016 15:08
-
-
Save meddulla/0412ca6a66eb2d797df1 to your computer and use it in GitHub Desktop.
Play framework upstart script
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
# | |
# Upstart script for Play Framework | |
# Put this into a file like /etc/init/play.conf | |
# | |
# Usage: | |
# initctl start play | |
# initctl stop play | |
# initctl status play | |
# | |
description "Start and Stop the play application" | |
env PROJ_HOME= | |
env PLAY_HOME=/opt/play-2.2.1 | |
env USER= | |
env GROUP= | |
start on (filesystem and net-device-up IFACE=lo) or runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
umask 022 | |
expect fork | |
# Specify the directory name instead of $PLAY_HOME variable | |
chdir /opt/play-2.2.1 | |
pre-start script | |
test -x $PLAY_HOME/play || { stop; exit 0; } | |
test -c /dev/null || { stop; exit 0; } | |
cd $PROJ_HOME | |
rm $PROJ_HOME/server.pid || true | |
$PLAY_HOME/play start $PROJ_HOME | |
end script | |
pre-stop exec $PLAY_HOME/play stop $PROJ_HOME | |
post-stop script | |
rm ${PROJ_HOME}/server.pid || true | |
cd $PROJ_HOME | |
$PLAY_HOME/play stop | |
end script | |
script | |
cd $PROJ_HOME | |
exec start-stop-daemon --start --exec $PLAY_HOME/play --chuid $USER:$GROUP -- start $PROJ_HOME | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment