I am trying to run Google AppEngine on my Debian machine, I created a file init.d/gae
:
. /lib/lsb/init-functions
#
# Initialize variables
#
name=gae
user=$name
pid=/var/run/$name.pid
prog="python /opt/google_appengine/dev_appserver.py --host=0.0.0.0 --admin_host=0.0.0.0 --php_executable_path=/usr/bin/php-cgi /var/www"
case "${1}" in
start)
echo "Starting...Google App Engine"
start-stop-daemon --start --make-pidfile --background --oknodo --user "$user" --name "$name" --pidfile "$pid" --startas "$prog"
;;
stop)
echo "Stopping...Google App Engine"
;;
restart)
${0} stop
sleep 1
${0} start
;;
*)
echo "Usage: ${0} {start|stop|restart}"
exit 1
;;
esac
exit 0
# End scriptname
I am testing the script by manually invoking, and the script runs but not as a daemon or at least it doesn't detach from terminal. I am expecting/looking for similar functionality to Apache.
What switch am I missing?
EDIT
I should note that no PID file is being written or created despite the switch indicating it should be created
/var/run
? – eyoung100 Sep 09 '14 at 23:39#!
definition defined. I think that will cause an issue. What do you want this to run as?bash
,sh
,ksh
? Putting a#!/bin/bash
will tell the system which shell to run this as. – Warwick Sep 09 '14 at 23:40prog=python /opt/google_appengine/dev_appserver.py...
line is missing quotes, causing it to get started there, not inside thestart-stop-daemon
code. – Mikel Sep 10 '14 at 02:41python
located and is that in the PATH when theinit.d
files are started. – Anthon Sep 10 '14 at 05:47echo $PATH > /var/tmp/path.tmp
restart the service and see what the path is. In your case I would just dotype python
from the commandline and hardcode the full path in the init.d instead of justpython
– Anthon Sep 10 '14 at 16:16