From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2564 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Newsgroups: gmane.comp.sysutils.supervision.general Subject: ToyBox oneit Date: Fri, 03 May 2019 04:44:32 +0200 Message-ID: <26098261556851472@iva8-b333b7f98ab0.qloud-c.yandex.net> References: <15044531556573627@iva6-ff1651a9aa83.qloud-c.yandex.net> <20190502003011.7wzyyms6ew74vvxf@cathexis.xen.prgmr.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="233130"; mail-complaints-to="usenet@blaine.gmane.org" To: "supervision@list.skarnet.org" Original-X-From: supervision-return-2154-gcsg-supervision=m.gmane.org@list.skarnet.org Fri May 03 04:44:37 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 1hMOBg-000yVb-PE for gcsg-supervision@m.gmane.org; Fri, 03 May 2019 04:44:36 +0200 Original-Received: (qmail 5413 invoked by uid 89); 3 May 2019 02:45:01 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Original-Received: (qmail 5406 invoked from network); 3 May 2019 02:45:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail; t=1556851472; bh=HLV/vwQNJ+qBWXRqyrbYWtREw97cBs0YqZ8dONSNQVs=; h=Message-Id:Subject:In-Reply-To:Date:References:To:From; b=taxH0aVj7SqF7kKdjvIJFr7RQtSkPFhVqxkmHq91r+ChtNgCymZOmaFSEEHWXhaWo ZQ/ekR+nsPZ5z7O6JL7vvGVUh0IA3LGKzlwUyiIAiZ94AVOuiVcKnY34kxmojPUTDU EooQzemF68FGHNW/u1bbIKwQhxr0UHGNblE2gExQ= Authentication-Results: mxback18g.mail.yandex.net; dkim=pass header.i=@yandex.com In-Reply-To: <20190502003011.7wzyyms6ew74vvxf@cathexis.xen.prgmr.com> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2564 Archived-At: > 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.