Hi Theodore,

> Anyway, I would like to have the system confirm a shutdown or reboot
> before actually doing it.

Why?
And who will be allowed to initiate a shutdown that way?

Without knowing that, it's hard to suggest a sane approach.

> I could do something like rename the shutdown/reboot/halt commands,

Do not fiddle with system commands, you are asking for trouble.

[...]
> seems like the cleanest solution would be to run a script
> from rc.shutdown to ask for conformation.
[...]
> What am I missing?

When init(8) is in the middle of dying,
  fork(2) & execl(3) & waitpid(2)  /bin/sh /etc/rc shutdown
is the very last thing it does before starting to kill off its
remaining children, i.e. all remaining userland processes.
At that point during init(8)'s death, most userland processes
are already dead, including all getty(8) terminal sessions,
so no user is logged in any more.
There is no way back into life from that point.
The only remaining choice is whether or not to power down the machine.
See /usr/src/sbin/init/init.c, function nice_death() for details.

In other words, in case you start committing suicide, but then reconsider
whether you would perhaps rather continue living, you might be better off
making the latter decision before chopping off all your arms and legs.

Reply via email to