init.d shell script can't stop daemon (python script)
this might be a little OT, but:
I wrote a (python) script that is acting like a daemon (doing something,
sleeping for 10 seconds, doing ..., sleeping ...) and would like to
launch and kill it from a shell script in /etc/init.d.
Using start-stop-daemon seemed appropriate, but the problems is that
no /var/run/$NAME.pid is written and /proc/<PID>/exe points to
/usr/bin/python. Hence stopping the daemon or preventing further deamons
from starting is not possible :(
Here's the relevant part of my init.d script:
test -f $DAEMON || exit 0
case "$1" in
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \