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

Gustavo Zacarias gustavo at zacarias.com.ar
Tue Dec 9 21:48:28 UTC 2014

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"


More information about the buildroot mailing list