Last active
December 14, 2015 02:39
-
-
Save craigmartin/5015607 to your computer and use it in GitHub Desktop.
a general default shell script to start a play app
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 | |
# | |
### BEGIN INIT INFO | |
# Provides: play app | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: play web application | |
# Description: Controls web application written with Play! framework | |
### END INIT INFO | |
NAME=myplayapp | |
DESC='My Play App' | |
PROJ_HOME=/home/projects/myplayapp | |
export JAVA_HOME=/opt/jdk/1.6.0_41/ | |
PLAY_HOME=/opt/play-1.1.1 | |
PLAY_USER=www-data | |
case "$1" in | |
start) | |
echo -n "Starting $DESC" | |
su -s /bin/sh -c 'exec "$0" "$@" > /dev/null' $PLAY_USER -- $PLAY_HOME/play start $PROJ_HOME | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping $DESC" | |
su -s /bin/sh -c 'exec "$0" "$@" > /dev/null' $PLAY_USER -- $PLAY_HOME/play stop $PROJ_HOME | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting $DESC" | |
su -s /bin/sh -c 'exec "$0" "$@" > /dev/null' $PLAY_USER -- $PLAY_HOME/play restart $PROJ_HOME | |
echo "." | |
;; | |
*) | |
echo "Usage: service myplayapp {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment