Thanks for reporting back to the list, Don. I'm sure this info will help someone down the road (maybe even me!) Kevin Horn On Thu, Apr 22, 2010 at 9:11 AM, Don Schoeman <don@delphexonline.com> wrote:
Hi guys,
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.
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!
Thanks all again for your help!
Best Regards, Don
Don Schoeman wrote:
Hi Jason,
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 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
Since this doesn't seem to be a problem related to twisted or twistd anymore I will start looking elsewhere for possible solutions.
Thanks for all the help from everyone anyway.
Regards, Don
Jason J. W. Williams wrote:
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 <don@delphexonline.com> <don@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 listTwisted-Python@twistedmatrix.comhttp://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing listTwisted-Python@twistedmatrix.comhttp://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
------------------------------
_______________________________________________ Twisted-Python mailing listTwisted-Python@twistedmatrix.comhttp://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