Hi Don, Here's the init.d we use for Twisted on Ubuntu. Sets the full path to Twistd:
http://gist.github.com/373978 -J On Wed, Apr 21, 2010 at 5:38 AM, Don Schoeman <d...@delphexonline.com> wrote: > Hi guys, > > My application is being executed using twistd as per documentation. All is > working fine but I need to have the service start automatically at boot > time. > > So as a test I've created a script in /etc/init.d/ which looks like this: > > #! /bin/sh > ### BEGIN INIT INFO > # Provides: ghserver > # Required-Start: $local_fs $remote_fs $network $syslog > # Required-Stop: $local_fs $remote_fs $network $syslog > # Default-Start: 2 3 4 5 > # Default-Stop: 0 1 6 > # Short-Description: Start/stop GHServer server > ### END INIT INFO > > logger "GHServer: Start script executed" > GH_SERVER_PATH="/home/myname/Python/ghserver" > export PYTHONPATH="$GH_SERVER_PATH:$PYTHONPATH" > > case "$1" in > start) > logger "GHServer: Starting" > echo "Starting GHServer..." > twistd -y "$GH_SERVER_PATH/ghserverapp.py" -l > "$GH_SERVER_PATH/ghserver.log" --pidfile "$GH_SERVER_PATH/twistd.pid" > ;; > stop) > logger "GHServer: Stopping" > echo "Stopping GHServer..." > kill `cat $GH_SERVER_PATH/twistd.pid` > ;; > *) > logger "GHServer: Invalid usage" > echo "Usage: /etc/init.d/ghserver {start|stop}" > exit 1 > ;; > esac > > exit 0 > > > This works fine when running /etc/init.d/ghserver start and > /etc/init.d/ghserver stop. The script also run when I boot since the logger > actually logs the "GHServer: Starting" text to the /var/log/messages file. > However, my service actually does not start. There is no pid to be found > anywhere, there are no error logs anywhere, just nothing. I might be doing > something wrong here but is there someone who's gone through this process > and can provide some samples how they did it? Any help will be greatly > appreciated. > > Kind Regards, > Don > > > > _______________________________________________ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > > _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python