From: "John O'Meara" <john.fr.omeara@gmail.com>
To: Laurent Bercot <ska-supervision@skarnet.org>
Cc: "supervision@list.skarnet.org" <supervision@list.skarnet.org>
Subject: Re: Generic interrupt command?
Date: Tue, 5 Feb 2019 09:16:55 -0500 [thread overview]
Message-ID: <CAPCpfp901i5nSXuyrqhRsth+7-PaK6nnQaz_VHGzgPRmLEhGoA@mail.gmail.com> (raw)
In-Reply-To: <em013aac3d-3413-4690-bca7-8b63204ff22b@elzian>
[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]
On Tue, Feb 5, 2019, 2:20 AM Laurent Bercot <ska-supervision@skarnet.org>
wrote:
> >Be careful, though. If the service is down, kill will use -1 for the PID,
> >and will probably signal everything in your system except PID 1.
>
> That's a good point. Should s6-svstat use 0 as the "service is down"
> pid value instead, to avoid this ?
>
0 behaves better for this use case, but can still produce unexpected
behavior.
The construction "echo 0 | xargs kill -STOP" for example leaves behind a
paused background task that needs to be cleaned by hand.
The construction "kill -STOP $(echo 0)" hangs the terminal until someone
resumes the user's shell.
Most other "kill -whatever $(echo 0)" results in the shell exiting and the
user having to log back in.
So, 0 is a lot better than -1, but still not great.
Not outputting anything causes kill (on my system at least) to exit non 0
and give some diagnostic ("`' not a pid or valid pid spec", "you need to
specify whom to kill", or the usage message). That's nice, but would
probably break other scripting that expects a value, especially for
s6-svstat showing multiple fields.
I can't think of a safe and simple way to do this. For example, we could
suggest people do something like this (based on Roger Pate's post):
pid=$(s6-svstat -p /my/service) && [ "$pid" -ne -1 ] && kill -SIGNAL $pid
but that's a lot of typing and requires that people see and remember the
suggestion, so not quite simple :-/
--
John O'Meara
>
next prev parent reply other threads:[~2019-02-05 14:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-02 2:36 Steve Litt
2019-02-02 9:07 ` Laurent Bercot
2019-02-02 19:30 ` Steve Litt
2019-02-02 21:08 ` Colin Booth
2019-02-02 21:40 ` Steve Litt
2019-02-05 3:09 ` John O'Meara
2019-02-05 4:15 ` Roger Pate
2019-02-05 7:20 ` Laurent Bercot
2019-02-05 14:16 ` John O'Meara [this message]
2019-02-05 19:30 ` Laurent Bercot
2019-02-10 4:14 ` John O'Meara
2019-02-10 11:41 ` Laurent Bercot
2019-02-02 22:31 ` Jonathan de Boyne Pollard
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=CAPCpfp901i5nSXuyrqhRsth+7-PaK6nnQaz_VHGzgPRmLEhGoA@mail.gmail.com \
--to=john.fr.omeara@gmail.com \
--cc=ska-supervision@skarnet.org \
--cc=supervision@list.skarnet.org \
/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;
as well as URLs for NNTP newsgroup(s).