<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Arial">Thank you Jason, I am looking at it right now.<br>
<br>
Regards,<br>
Don<br>
<br>
</font><br>
Jason J. W. Williams wrote:
<blockquote
 cite="mid:j2q3b949f091004210837q6bcf731ar63f1471348e2adf9@mail.gmail.com"
 type="cite">
  <pre wrap="">Hi Don,

Here's the init.d we use for Twisted on Ubuntu. Sets the full path to Twistd:

<a class="moz-txt-link-freetext" href="http://gist.github.com/373978">http://gist.github.com/373978</a>

-J

On Wed, Apr 21, 2010 at 5:38 AM, Don Schoeman <a class="moz-txt-link-rfc2396E" href="mailto:don@delphexonline.com">&lt;don@delphexonline.com&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ghserver
# Required-Start:&nbsp;&nbsp;&nbsp; $local_fs $remote_fs $network $syslog
# Required-Stop:&nbsp;&nbsp;&nbsp;&nbsp; $local_fs $remote_fs $network $syslog
# Default-Start:&nbsp;&nbsp;&nbsp;&nbsp; 2 3 4 5
# Default-Stop:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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
&nbsp; start)
&nbsp;&nbsp;&nbsp; logger "GHServer: Starting"
&nbsp;&nbsp;&nbsp; echo "Starting GHServer..."
&nbsp;&nbsp;&nbsp; twistd -y "$GH_SERVER_PATH/ghserverapp.py" -l
"$GH_SERVER_PATH/ghserver.log" --pidfile "$GH_SERVER_PATH/twistd.pid"
&nbsp;&nbsp;&nbsp; ;;
&nbsp; stop)
&nbsp;&nbsp;&nbsp; logger "GHServer: Stopping"
&nbsp;&nbsp;&nbsp; echo "Stopping GHServer..."
&nbsp;&nbsp;&nbsp; kill `cat $GH_SERVER_PATH/twistd.pid`
&nbsp;&nbsp;&nbsp; ;;
&nbsp; *)
&nbsp;&nbsp;&nbsp; logger "GHServer: Invalid usage"
&nbsp;&nbsp;&nbsp; echo "Usage: /etc/init.d/ghserver {start|stop}"
&nbsp;&nbsp;&nbsp; exit 1
&nbsp;&nbsp;&nbsp; ;;
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
<a class="moz-txt-link-abbreviated" href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a class="moz-txt-link-freetext" href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
Twisted-Python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a class="moz-txt-link-freetext" href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>

  </pre>
</blockquote>
</body>
</html>