From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2504 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "John O'Meara" Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Generic interrupt command? Date: Tue, 5 Feb 2019 09:16:55 -0500 Message-ID: References: <20190201213620.68abc837@mydesk.domain.cxm> <20190202143014.77a5ac5f@mydesk.domain.cxm> <20190202210810.qckhzw4zgfxui6u3@cathexis.xen.prgmr.com> <20190202164042.20551e42@mydesk.domain.cxm> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009538c605812643b5" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="249520"; mail-complaints-to="usenet@blaine.gmane.org" Cc: "supervision@list.skarnet.org" To: Laurent Bercot Original-X-From: supervision-return-2094-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Feb 05 15:17:10 2019 Return-path: Envelope-to: gcsg-supervision@m.gmane.org Original-Received: from alyss.skarnet.org ([95.142.172.232]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1gr1XC-0012qS-CP for gcsg-supervision@m.gmane.org; Tue, 05 Feb 2019 15:17:10 +0100 Original-Received: (qmail 23719 invoked by uid 89); 5 Feb 2019 14:17:34 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 23711 invoked from network); 5 Feb 2019 14:17:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7ADgqo2Qr7/msyf61wLk5Liwn4SmyCLHQNRVBsdBDec=; b=iLa+SCzphW4NYizM8NOf3rWcPHb6wVXjRZhF5I/+uoh69VdRsAvYQ/x5rsGh2Oq3yx rwxu9zE+qijsCeicFx865j4RZiWVWv7dqgiIp3+EVsP99VA3MaPwb6bWBPisXoZd+h7u xNRlFKfCmTThtyLhCUXunVUyAg6kdzR9o1HpmcLopq7paZAI/XAXX3ssI8Ti92VrOncl vGPat48Ssr2qqZmU3bMxQq4If/KoCTHdJ2ohVMGimT/NBLgs79ppLsPwUDCQU5ti05MZ H59hNI42o8RBncz1bnzBdFq1z9eFpMWMrtH5BowKiYPUnWK2YkQBzRaIsgZG0YwXob4c VVig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7ADgqo2Qr7/msyf61wLk5Liwn4SmyCLHQNRVBsdBDec=; b=Az69VvFINTKyvCTQL9War/ICj5QfZDhEp0wvmvvoYMcLMy0+rqk+PEF0gHDhAg5LXb C3CMpA51LzGSh85//nIPAPRwpiJ9LZ6K4FYAPZyrGA/crb6XxBaq6V1vPmY5O3d5hCTC etckWKJNy9ge98WgrUgqtNioqnS03lmGSQQUm3ChLgupt8AQfil4TAU1n+ojHRZtAITe BZz1co6NVNPNxiwmvo5aQrN0WCoCaaK3wIZWr8/vG2nppy162yJU7aZkL8D7wfLkn3qx fxiqGzkOvERCWg8qYgGqpaGz7KChUq6PlR6El10ULr23UQtjKHYWJKR6zOyZobbxMUoP NKzA== X-Gm-Message-State: AHQUAua4C8jTjS1oNIw21++jZvLmxpECZJoFcEJ5uMJTQzG0TazHTDzp 4ya7Snvw8FPrdv4rIEsaLFnqHU+/0kK10mldK7A= X-Google-Smtp-Source: AHgI3IZd71TtjpVEbOTujKEhXKbk44mNh506xhXgLw970bqHFWczYPUgc0Wm5P71D4OacgDO+q1CWZpQ4x6SjAN5Cfo= X-Received: by 2002:a5d:8243:: with SMTP id n3mr2584313ioo.94.1549376226145; Tue, 05 Feb 2019 06:17:06 -0800 (PST) In-Reply-To: Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2504 Archived-At: --0000000000009538c605812643b5 Content-Type: text/plain; charset="UTF-8" On Tue, Feb 5, 2019, 2:20 AM Laurent Bercot 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 > --0000000000009538c605812643b5--