[Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile

Jörg Krause jkrause at posteo.de
Tue Dec 9 21:58:36 UTC 2014


On Di, 2014-12-09 at 18:48 -0300, Gustavo Zacarias wrote:
> On 12/09/2014 06:35 PM, Jörg Krause wrote:
> 
> > I want to check in a script if the dnsmasq daemon is running by testing
> > for the existence of the pid file.
> 
> Generally speaking it's bad practice to just check the pidfile to know
> if some daemon is running, because if it dies unexpectedly you'll still
> have the pidfile around.
> You should probably use a double check of pidfile and match the process,
> something like (in shell):
> 
> grep dnsmasq /proc/`cat /var/run/dnsmasq.pid`/cmdline >/dev/null 2>&1 &&
> echo "YES" || echo "NO"

I thought so. I've seen it in some other scripts... Many thanks for the
advice!




More information about the buildroot mailing list