bottledaemon stop/start doesn't work if killed elsewhere

Adam Funk a24061 at ducksburg.com
Tue Nov 20 13:33:16 UTC 2018


On 2018-11-18, Robert Heller wrote:

> At Sun, 18 Nov 2018 17:32:12 +0000 "Ubuntu user technical support,  not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:
>
>> 
>> Hi,
>> 
>> I'm using bottledaemon to run a little REST service on a Pi that takes
>> input from other machines on the LAN and stores stuff in a database.
>> I have a cron job to call 'stop' and 'start' on it daily, just in case
>> of problems.
>> 
>> Occasionally the oom-killer runs overnight and kills the process using
>> bottledaemon; when this happens (unlike properly stopping the daemon),
>> the pidfile and its lockfile are left on the filesystem, so the 'stop'
>> does nothing and the 'start' gets refusedq because the old pidfile and
>> lockfile are present.  At the moment, I eventually notice something
>> wrong with the output data, ssh into the Pi, and rm the two files then
>> call 'start' on the daemon again.
>> 
>> Is there a recommended or good way to handle this situation
>> automatically?
>
> This is *definately* a bug in the systemd service scripts for bottledaemon. 
> The stop script should rm the pidfile and lockfile, even if the daemon happens 
> to be dead.  This is what any *properly* written daemon stop script does.  So, 
> you need to file a bug report.  In fact the *start* script should check to see 
> if the pidfile and lockfile are still legit -- eg is the pid in the pidfile a 
> valid pid, etc.  Also part of a *properly* written daemon start script.

I've reported this is an issue on github.  I guess for now I could
replace the crontab command

~/sensors/server-sensors.py stop ; ~/sensors/server-sensors.py start

with this?

~/sensors/server-sensors.py stop ; rm -f /tmp/sensors-server.pid /tmp/sensors-server.pid.lock ; ~/sensors/server-sensors.py start





More information about the ubuntu-users mailing list