Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

init.d script to launch Play framework under Ubuntu

View init.d play
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
 
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
 
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
export JAVA_HOME
 
# User running the Play process
USER=www-data
 
# Path to the application
APPLICATION_PATH=/var/www/playapps/NAME_OF_APPLICATION
 
. /lib/lsb/init-functions
 
case "$1" in
start)
echo -n "Starting Play service: "
rm -f ${APPLICATION_PATH}/server.pid
su $USER -c "${PLAY} start ${APPLICATION_PATH} --%production >/dev/null"
RETVAL=$?
 
# You may want to start more applications as follows
# [ $RETVAL -eq 0 ] && su $USER -c "${PLAY} start application2"
# RETVAL=$?
 
if [ $RETVAL -eq 0 ]; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
echo -n "Shutting down Play service: "
${PLAY} stop ${APPLICATION_PATH} > /dev/null
# ${PLAY} stop application2 > /dev/null
 
RETVAL=$?
 
if [ $RETVAL -eq 0 ]; then
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
${PLAY} status ${APPLICATION_PATH}
RETVAL=$?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status}" >&2
exit 1
;;
esac
 
exit 0
 
 
 

Does it work on Play 2.2.x? It didn't for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.