Skip to content

Instantly share code, notes, and snippets.

@shantanusingh
Created June 17, 2014 11:56
Show Gist options
  • Save shantanusingh/3d868eedda71540dd909 to your computer and use it in GitHub Desktop.
Save shantanusingh/3d868eedda71540dd909 to your computer and use it in GitHub Desktop.
Play 2 init.d script
#!/bin/bash
# description: UAB Play App
# processname: uab
# chkconfig: 234 20 80
# User running the Play process
USER=ec2-user
USER_HOME=/home/ec2-user
# Java home, add java and play to path
#export JAVA_HOME=$USER_HOME/java_home
export PATH=$JAVA_HOME/bin:$USER_HOME/libs/play:$PATH
# Path to the application
APP_PATH=$USER_HOME/apps/uab/target/universal/stage
APP_OPTS="-Dconfig.file=$APP_PATH/conf/prod.conf"
RETVAL=0
case "$1" in
start)
echo -n "Starting Play service"
rm -f ${APP_PATH}/RUNNING_PID
su $USER -c "$APP_PATH/bin/uab $APP_OPTS >/dev/null" &
RETVAL=$?
;;
stop)
echo -n "Shutting down Play service"
kill `cat $APP_PATH/RUNNING_PID`
RETVAL=$?
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment