Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
Date: Tue, 09 Dec 2014 18:48:28 -0300	[thread overview]
Message-ID: <54876E2C.6060208@zacarias.com.ar> (raw)
In-Reply-To: <1418160957.1422.38.camel@posteo.de>

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"

Regards.

  reply	other threads:[~2014-12-09 21:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 16:27 [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile Jörg Krause
2014-12-09 20:04 ` Gustavo Zacarias
2014-12-09 21:35   ` Jörg Krause
2014-12-09 21:48     ` Gustavo Zacarias [this message]
2014-12-09 21:58       ` Jörg Krause
2014-12-10 20:56         ` Gustavo Zacarias

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54876E2C.6060208@zacarias.com.ar \
    --to=gustavo@zacarias.com.ar \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox