starting a python script daemon at Linux boot time

Mookie D. mookied at iname.com
Sun May 16 01:27:16 EDT 1999


Hi folks,

I apologize if the cross-posting is inappropriate -- I'm not sure which
of these two forums has more experience with this.

Trying to start a daemon process that's written in python, that I need
to start up every time the machine turns on. I am not sure how to handle
a few things in /etc/rc.d/init.d script... (or if there's a better way
to get the desired result, I'd like to know.)

QUESTION #1: How to kill it w/o killing all python processes

I run the script dmbooter.py, which has #!/usr/local/bin/python for the
first line... but the process is the python interpreter instead of
dmbooter.py, i.e.:

   22787  p0 S    0:00 python /usr/local/bin/dmbooter.py

I copied the 'atd' script and modified it for my purposes, but the
killproc approach when stopping it only looks at the program name
(python), which will kill any and all python interpreters running, or
maybe just a random one.

QUESTION #2: Need to run it as background task from init.d script?

I discovered that running "./dmbooter start" didn't return, so I added
an & to the daemon line of start part of script:

            daemon /usr/local/dm/booter/dmbooter.py &

Is this ok to do?

QUESTION #3: What if dmbooter.py has stdout or stderr output? Where does
it go?  Should I redirect it somewhere?

thanks in advance for any suggestions/advice/pointers,
Mook


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---




More information about the Python-list mailing list