do stuff after shutdown
Michael Conrad
mconrad at intellitree.com
Fri Feb 24 21:47:35 UTC 2012
On 2/23/2012 7:59 PM, Laurent Bercot wrote:
> You mean process 1. ;)
Right :-) Whose idea was it to count from 1, anyway?
> [ Side note : panicking when process 1 exits is a *very* silly thing
> for the kernel to do. Process 1 exiting, instead of being forbidden,
> should mean the end of the machine's life cycle, and the kernel should
> either halt, reboot, or even kexec something else, depending on process
> 1's exit code. But that is totally off-topic. ]
I agree. But they probably have hard-coded assumptions about process 1
always existing in the process table or something.
Speaking of kexec though, that reminds me: if someone wanted to run an
unknown distro (like from a iso image or something) and then clean up
afterward, you could run your own init, start the distro as normal,
receive its shutdown request, mount read-only, sync, etc, and then kexec
into a new kernel with an embedded busybox to run a cleanup script.
You can also install a panic-kernel, to be kexec'd any time the kernel
crashes. I think that's a pretty killer feature. In fact you could
install the panic-kernel with the embedded cleanup script, and then
deliberately exit from your init at shutdown ;-)
> And none of this has the slightest thing to do with busybox. ;)
Other than that people who play with busybox are often trying to do
hackish things like these :-) I felt obligated to answer since I had
started into embedded linux with many of the same questions as the OP.
-Mike
More information about the busybox
mailing list