Re: Shutdown/reboot script order?

From: Steve Litt <slitt_at_troubleshooters.com>
Date: Wed, 10 Jun 2015 13:13:43 -0400

On Tue, 09 Jun 2015 18:08:08 +0200
Laurent Bercot <ska-supervision_at_skarnet.org> wrote:

> On 09/06/2015 16:24, Steve Litt wrote:
> > * killall5 -15; sleep 2; killall5 -9; sleep 2
> >
> > * umount -a
> >
> > * mount -o remount,ro /dev/sda1
> >
> > * /sbin/halt or /sbin/reboot
> >
> > Could somebody confirm which order these things come in?
>
> You got the right order.
>
> Note that killall5 is heavy, kludgy and System V-specific.

Does the preceding sentence mean that killall5 is available only when
sysvinit is installed? That could be a problem.

>
> If your shell has a "kill" builtin, you can simply replace
> "killall5 -15" with "kill -15 -1", and "killall5 -9" with
> "kill -9 -1". It will work on Linux.
> If your shell does not have a "kill" builtin, you're out of
> luck, unless your script is running as process 1.

I think I could theoretically change Suckless-Init to
run /bin/rc.shutdown with an exec so it *is* pid1. I think.

>
> This is one of the reasons why I advocate running the last part
> of the shutdown procedure as process 1 - it makes the final nuke
> easy and portable.

How would one run a shutdown script as a PID higher than 1, then
magically change back to PID1? Would you run 2 different shutdown
scripts: one for the standard stuff, and one for the "killalls"?

Thanks,

SteveT

Steve Litt
June 2015 featured book: The Key to Everyday Excellence
http://www.troubleshooters.com/key
Received on Wed Jun 10 2015 - 17:13:43 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC