Last active
December 28, 2015 07:39
-
-
Save jakob85/7466158 to your computer and use it in GitHub Desktop.
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 | |
#decription: Starts play app using daemon | |
# 1. Go to $APPLICATION_PATH and prepare for dev by doing: play clean compile stage | |
# This will create a start script at target/start | |
# 2. Start the application by running this script | |
# created by: Jakob Dobrzynski | |
# some corrections by mdk | |
PLAY_HOME=/usr/share/play | |
PLAY=$PLAY_HOME/play | |
NAME=test | |
DESC="test application" | |
USER=playapps | |
# Path to the JVM | |
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45/jre | |
export JAVA_HOME | |
export PATH=$PATH:$JAVA_HOME/bin | |
APPLICATION_PATH=/apps/test | |
DAEMON_OPTS="-J-Xmx128m -J-Xms128m -Dconfig.file=/apps/test/conf/application.conf -Dhttp.port=9003" | |
DAEMON="$APPLICATION_PATH/target/universal/stage/bin/test" | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
su $USER -c "$APPLICATION_PATH/target/universal/stage/bin/test $DAEMON_OPTS & >/dev/null" | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
kill `cat "$APPLICATION_PATH/target/universal/stage/RUNNING_PID"` | |
;; | |
restart|force-reload) | |
${0} stop | |
sleep 0.5 | |
${0} start | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment