emoncms/raspberrypi — pull request #18 by Jerome-github (2013-04-08 11:08:59+00:00)
Title: RFM2Pi Gateway init script: don't run 2 instances

Don't start again when process already running
Verbose output for start, stop, already started/stopped
Make root credentials mandatory

------------------------------------------------------------------------------------

Note that when stopping, the script only checks the PID number. If the process is already dead and a new process took its PID, this innoncent process will get killed.

(See here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=668332)

I also made root creds mandatory because otherwise, user pi could call /etc/init.d/rfm2pigateway stop. This would stop the process (it is run as user pi) but not remove the PID file, thus yielding an error message and leaving the user in a badly defined state with status "running" and the memory of a PID that could be reused by any other process.