<!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">Hi guys,<br>
<br>
I have finally managed to solve this problem. It turns out (as
predicted) that this is not a twistd problem after all. This particular
Ubuntu server has an encrypted home directory (enabled through
eCryptfs). This means that during the boot process the particular home
directory from which I tried running my tests was not available as even
the root user do not have access to the home directory until it is
de-crypted after the particular user actually logs in. This is why the
tests ran fine after login but not during boot.<br>
<br>
For more experienced Linux admins this would have been tracked down
within minutes but it took me a full day worth of testing before I
finally managed to track down the problem. To resolve the issue I moved
the server to /usr/local/lib/python2.6/dist-packages/ghserver and I am
now executing it from there instead and it starts up during boot just
as expected. I am extremely relieved!<br>
<br>
Thanks all again for your help!<br>
<br>
Best Regards,<br>
Don<br>
</font><br>
<br>
Don Schoeman wrote:
<blockquote cite="mid:4BCF24C5.5010204@delphexonline.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
  <font face="Arial">Hi Jason,<br>
  <br>
Unfortunately I still have the same problem. However, I now realise
that it might be a privileges issue of some kind. Being fairly new at
linux&nbsp; this may take days to figure out; can you perhaps remember if
you enabled your rc script using the command update-rc.d? I used it in
the following way: sudo update-rc.d ghserver defaults<br>
  <br>
Since this doesn't seem to be a problem related to twisted or twistd
anymore I will start looking elsewhere for possible solutions.<br>
  <br>
Thanks for all the help from everyone anyway.<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 moz-do-not-send="true" 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 moz-do-not-send="true"
 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 moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a moz-do-not-send="true" 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="">
<hr size="4" width="90%">
_______________________________________________
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>