supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Jeff <sysinit@yandex.com>
To: "supervision@list.skarnet.org" <supervision@list.skarnet.org>
Subject: ToyBox oneit
Date: Fri, 03 May 2019 04:44:32 +0200	[thread overview]
Message-ID: <26098261556851472@iva8-b333b7f98ab0.qloud-c.yandex.net> (raw)
In-Reply-To: <20190502003011.7wzyyms6ew74vvxf@cathexis.xen.prgmr.com>

> By this redefinition, a good init is one that doesn't allow systems to go
> vegetable, either by having something they restart, or totally freaking
> out and burning down the world if the one thing they started ever
> vanishes.
>
> sinit could be made proper by forking a thing and then
> issuing the reboot(2) syscall any time its child vanished.
> Annoyingly aggressive on the restarts, but proper.

maybe you should have a look at the tiny "oneit" utility that is
part of/included in ToyBox ( http://landley.net/toybox/ ):

$ toybox help oneit

usage: oneit [-p] [-c /dev/tty0] command [...]

Simple init program that runs a single supplied command line with a
controlling tty (so CTRL-C can kill it).

-c     Which console device to use (/dev/console doesn't do CTRL-C, etc)
-p     Power off instead of rebooting when command exits
-r      Restart child when it exits
-3     Write 32 bit PID of each exiting reparented process to fd 3 of child
        (Blocking writes, child must read to avoid eventual deadlock.)

Spawns a single child process (because PID 1 has signals blocked)
in its own session, reaps zombies until the child exits, then
reboots the system (or powers off with -p, or restarts the child with -r).

Responds to SIGUSR1 by halting the system, SIGUSR2 by powering off,
and SIGTERM or SIGINT reboot.




  reply	other threads:[~2019-05-03  2:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 21:33 further claims Jeff
2019-04-30  8:56 ` Laurent Bercot
2019-05-01 23:09   ` Guillermo
2019-05-02  0:30     ` Colin Booth
2019-05-03  2:44       ` Jeff [this message]
2019-05-05  2:07         ` ToyBox init Jeff
2019-05-03  2:15     ` Runit Jeff

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=26098261556851472@iva8-b333b7f98ab0.qloud-c.yandex.net \
    --to=sysinit@yandex.com \
    --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).