I'm trying to control a python based program (which doesn't detach itself from console)
#!/bin/bash
user=nobody
pid=/var/run/xx.pid
name=xx
prog=/xx.py
case $1 in
start)
/sbin/start-stop-daemon --start -b --oknodo --user "$user" --name "$name" --pidfile "$pid" --startas "$prog" --chuid nobody -- --daemon
;;
stop)
/sbin/start-stop-daemon --stop --oknodo --user "$user" --name "$name" --pidfile "$pid" --retry=TERM/5/KILL/1
;;
restart)
;;
*)
;;
esac
The start part works fine. I can see the script up and running, but the stop part doesn't.
It simply says No xx found running; none killed.
So I guess there's something wrong with the start part?