Ok here is one solution after tips from favoretti:
#! /bin/sh
# description: Starts autocomplete 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
. /etc/rc.d/init.d/functions
PLAY_HOME=/opt/play
PLAY=$PLAY_HOME/play
NAME=autocomplete
DESC="autocomplete application"
# Path to the JVM
JAVA_HOME=/usr/java/latest
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
APPLICATION_PATH=/opt/playapps/autocomplete
DAEMON_OPTS="-Dconfig.file=/opt/playapps/autocomplete/conf/application-dev.conf"
start()
{
echo -n "Starting $DESC with: $APPLICATION_PATH/target/start $DAEMON_OPTS &"
$APPLICATION_PATH/target/start $DAEMON_OPTS &
}
stop()
{
echo -n $"Stopping $DESC:"
kill `cat $APPLICATION_PATH/RUNNING_PID`
}
case "$1" in
start)
start
;;
stop)
stop
;;
esac
exit $RETVAL
You will need to CTRL+D to get out of the console which isn't exactly what I had in mind. Maybe there is someone out there with a better solution?