> See? This requires no communication with init, or > knowledge about other running processes: Unix programs > *have to* shutdown on SIGTERM, with a very few exceptions. > Bad boys will be dealt with SIGKILL anyway.
You are forgetting two things ;) 1. Supervision systems rooted in process 1 - including sysvinit and busybox init - automatically restart one or more processes when they die, which is a good thing since it guarantees that the machine will always be in a usable state (provided supervised services are properly configured). Automatically restarted processes might prevent filesystem unmounting. So, before killing everything manually to shut down the OS, it is necessary to disable supervision. If the supervision chain is rooted in process 1 as it should be, this can only be done by signalling process 1 in some way. 2. Your manual shutdown script will kill itself when it sends SIGKILL to everyone, and will not complete. The only way to prevent that is to run the shutdown procedure as process 1 - or at least to have a hook in process 1 to run the remaining shutdown script after the kill. Manually shutting down works in your example because you have a shell running as process 1, which 1. provides no supervision, and 2. survives the nuke button. So yes, it may not be very satisfying to require specific shutdown support in init, but it is necessary in the general case. -- Laurent _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
