* [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
@ 2014-11-15 16:27 Jörg Krause
2014-12-09 20:04 ` Gustavo Zacarias
0 siblings, 1 reply; 6+ messages in thread
From: Jörg Krause @ 2014-11-15 16:27 UTC (permalink / raw)
To: buildroot
dnsmasq does not clean up its pidfile after termination. Do this manually.
Supersedes: [PATCH 1/1] package/dnsmasq: cleanup run-time files in init script
https://patchwork.ozlabs.org/patch/411015/
Signed-off-by: J?rg Krause <jkrause@posteo.de>
---
package/dnsmasq/S80dnsmasq | 2 ++
1 file changed, 2 insertions(+)
diff --git a/package/dnsmasq/S80dnsmasq b/package/dnsmasq/S80dnsmasq
index 587751e..ca74d8b 100755
--- a/package/dnsmasq/S80dnsmasq
+++ b/package/dnsmasq/S80dnsmasq
@@ -13,6 +13,8 @@ case "$1" in
echo -n "Stopping dnsmasq: "
start-stop-daemon -K -q -x /usr/sbin/dnsmasq
[ $? = 0 ] && echo "OK" || echo "FAIL"
+ # dnsmasq does not clean its pid file
+ rm -f /var/run/dnsmasq.pid
;;
restart|reload)
$0 stop
--
2.1.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
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
0 siblings, 1 reply; 6+ messages in thread
From: Gustavo Zacarias @ 2014-12-09 20:04 UTC (permalink / raw)
To: buildroot
On 11/15/2014 01:27 PM, J?rg Krause wrote:
> dnsmasq does not clean up its pidfile after termination. Do this manually.
>
> Supersedes: [PATCH 1/1] package/dnsmasq: cleanup run-time files in init script
> https://patchwork.ozlabs.org/patch/411015/
Hi.
Does it fix anything in particular other than looks?
Looking at the dnsmasq source it does an unlink() on successful
startup/fork so any previous pidfile doesn't bother it at all.
I was about to say "i'd like to see the start-stop-daemon invocation
changed" but then i realized that it doesn't remove the pidfile either,
so basically any "start-stop-daemon -K -q -x" in any initscript
"suffers" from this "problem".
So even if the pidfile is on permanent storage i don't see how this can
cause issues.
Regards.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
2014-12-09 20:04 ` Gustavo Zacarias
@ 2014-12-09 21:35 ` Jörg Krause
2014-12-09 21:48 ` Gustavo Zacarias
0 siblings, 1 reply; 6+ messages in thread
From: Jörg Krause @ 2014-12-09 21:35 UTC (permalink / raw)
To: buildroot
On Di, 2014-12-09 at 17:04 -0300, Gustavo Zacarias wrote:
> On 11/15/2014 01:27 PM, J?rg Krause wrote:
>
> > dnsmasq does not clean up its pidfile after termination. Do this manually.
> >
> > Supersedes: [PATCH 1/1] package/dnsmasq: cleanup run-time files in init script
> > https://patchwork.ozlabs.org/patch/411015/
>
> Hi.
> Does it fix anything in particular other than looks?
> Looking at the dnsmasq source it does an unlink() on successful
> startup/fork so any previous pidfile doesn't bother it at all.
> I was about to say "i'd like to see the start-stop-daemon invocation
> changed" but then i realized that it doesn't remove the pidfile either,
> so basically any "start-stop-daemon -K -q -x" in any initscript
> "suffers" from this "problem".
> So even if the pidfile is on permanent storage i don't see how this can
> cause issues.
> Regards.
>
I want to check in a script if the dnsmasq daemon is running by testing
for the existence of the pid file.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
2014-12-09 21:35 ` Jörg Krause
@ 2014-12-09 21:48 ` Gustavo Zacarias
2014-12-09 21:58 ` Jörg Krause
0 siblings, 1 reply; 6+ messages in thread
From: Gustavo Zacarias @ 2014-12-09 21:48 UTC (permalink / raw)
To: buildroot
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
2014-12-09 21:48 ` Gustavo Zacarias
@ 2014-12-09 21:58 ` Jörg Krause
2014-12-10 20:56 ` Gustavo Zacarias
0 siblings, 1 reply; 6+ messages in thread
From: Jörg Krause @ 2014-12-09 21:58 UTC (permalink / raw)
To: buildroot
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!
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] package/dnsmasq: let init script cleanup stale pidfile
2014-12-09 21:58 ` Jörg Krause
@ 2014-12-10 20:56 ` Gustavo Zacarias
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo Zacarias @ 2014-12-10 20:56 UTC (permalink / raw)
To: buildroot
On 12/09/2014 06:58 PM, J?rg Krause wrote:
> I thought so. I've seen it in some other scripts... Many thanks for the
> advice!
I'll mark the patch as "not applicable" since it doesn't really address
the core issue.
Thanks.
Regards.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-10 20:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-12-09 21:58 ` Jörg Krause
2014-12-10 20:56 ` Gustavo Zacarias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox