Daemon Creation
- From: Robert Rawlins <robert_rawlins@xxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 17:08:15 +0000
Hello Guys,
I’ve got a python script which I’m looking to launch as a Daemon on my system. There are a few things which need to be handled on the python side of things to get this to work, but I can deal with these myself without any issues.
Where I DO need help though is with regards to writing the Daemon file for init.d which can then be used to launch and stop the Daemon. I hound an excellent little tutorial based here: http://girasoli.org/?p=120 which has helped me get started by creating a copy of the skeleton Daemon and start to customize it, however, it seems a little out of date and I need a little help with this.
Within the Daemon control script we have do_start() and do_stop() methods. I need to know if these really need to be modified as stated in the tutorial? At the moment my start script looks like this:
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
Is that correct? Presumably I need to remove one of those start commands? Right? The same rule applied to the do_stop() method which currently contains a start-stop-daemon request, do I need to replace that with a standard kill command? Or will the start-stop-daemon handle that for me?
Thanks for any input you can offer guys, I appreciate it.
Robert
_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx
- Prev by Date: Re: getting gs to see ttf fonts
- Next by Date: Re: Newsreader question
- Previous by thread: Newsreader question
- Next by thread: vertical scroll on my touchpad not working
- Index(es):
Relevant Pages
|