I still get the same results (or non-results) unfortunately. I have tried the following options:

1) Tried running twistd by giving the fully qualified path: /usr/bin/twistd.
2) Tried running the .tac file together with the -g twistd switch instead.
3) Tried the --syslog switch to see if I can find anything in the logs.
4) Tried running it without supplying custom log and pid files.

It almost seems to me that twistd thinks that it started the daemon fine, although it clearly does not. Can anyone tell me if twistd returns any error codes, maybe I can check that? Please note again, running it with "/etc/init.d/ghserver start" still works flawlessly, it is only when I try and run during the boot process.

I am starting to think that I should perhaps try running it from /etc/rc.local instead.

Regards,
Don




gary clark wrote:

My understanding is the twistd will have a default log twistd.log.
 
Thanks,
Garyc

--- On Wed, 4/21/10, Don Schoeman <don@delphexonline.com> wrote:

From: Don Schoeman <don@delphexonline.com>
Subject: Re: [Twisted-Python] twistd and init.d
To: "Twisted general discussion" <twisted-python@twistedmatrix.com>
Date: Wednesday, April 21, 2010, 7:54 AM

Sorry, I mean't to say I will use the full path to twistd (i.e. /usr/bin/twistd) and see if that works.

Don Schoeman wrote:
Thanks for the tips guys,

Maartin, I have a feeling that you may be correct. I'm going to see if I can't set the python path within the script.

Tim, the only reason I can see anything in  /var/logs/messages is because I use the "logger" tool to log those messages directly from the bash shell script. See the script below.

Kind Regards,
Don


Don Schoeman 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

-----Inline Attachment Follows-----

_______________________________________________
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