<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Arial">Hi guys,<br>
<br>
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.<br>
<br>
So as a test I've created a script in /etc/init.d/ which looks like
this:<br>
<font face="Courier New, Courier, monospace"><br>
#! /bin/sh<br>
### BEGIN INIT INFO<br>
# Provides:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ghserver<br>
# Required-Start:&nbsp;&nbsp;&nbsp; $local_fs $remote_fs $network $syslog<br>
# Required-Stop:&nbsp;&nbsp;&nbsp;&nbsp; $local_fs $remote_fs $network $syslog<br>
# Default-Start:&nbsp;&nbsp;&nbsp;&nbsp; 2 3 4 5<br>
# Default-Stop:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 1 6<br>
# Short-Description: Start/stop GHServer server<br>
### END INIT INFO<br>
<br>
logger "GHServer: Start script executed"<br>
GH_SERVER_PATH="/home/myname/Python/ghserver"<br>
export PYTHONPATH="$GH_SERVER_PATH:$PYTHONPATH"<br>
<br>
case "$1" in<br>
&nbsp; start)<br>
&nbsp;&nbsp;&nbsp; logger "GHServer: Starting"<br>
&nbsp;&nbsp;&nbsp; echo "Starting GHServer..."<br>
&nbsp;&nbsp;&nbsp; twistd -y "$GH_SERVER_PATH/ghserverapp.py" -l
"$GH_SERVER_PATH/ghserver.log" --pidfile "$GH_SERVER_PATH/twistd.pid"<br>
&nbsp;&nbsp;&nbsp; ;;<br>
&nbsp; stop)<br>
&nbsp;&nbsp;&nbsp; logger "GHServer: Stopping"<br>
&nbsp;&nbsp;&nbsp; echo "Stopping GHServer..."<br>
&nbsp;&nbsp;&nbsp; kill `cat $GH_SERVER_PATH/twistd.pid`<br>
&nbsp;&nbsp;&nbsp; ;;<br>
&nbsp; *)<br>
&nbsp;&nbsp;&nbsp; logger "GHServer: Invalid usage"<br>
&nbsp;&nbsp;&nbsp; echo "Usage: /etc/init.d/ghserver {start|stop}"<br>
&nbsp;&nbsp;&nbsp; exit 1<br>
&nbsp;&nbsp;&nbsp; ;;<br>
esac<br>
<br>
exit 0</font><br>
<br>
<br>
This works fine when running /etc/init.d/ghserver start and</font><font
 face="Arial"> /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.<br>
<br>
Kind Regards,<br>
Don<br>
<br>
<br>
</font><font face="Arial"></font>
</body>
</html>