Jeremy Katz (katzj@xxxxxxxxxx) said:
Most services don't need any magic to shutdown "properly". Why stop ssh via the initscript when all it's going to do is kill the process if you have a killall happening not long afterward.
Definitely.
Exactly... what needs to be done here is tagging of all the scripts/services that can be shut down cleanly, then some quick changes to /etc/rc should cut about half the time out of shutdown (based on some tests I ran ~10 months ago or so.)
How about a "prepare-for-system-shutdown" [1] command to the rc scripts? With the meaning of "save anything you need to 'cos the system's going down shortly" rather than "i want you to exit all your processes right now" (the 'stop' command). For most services this could just be a NOP. Others could trivially call their 'stop' command, or do whatever subset of that is necessary.
[1] a more succient name should obviously be used. :) Actually, how about 'save', and 'stop' could in general call that and then do its killings?
Of course currently that would still involve the overhead of forking the shell scripts to handle execute each rc command (which would exit almost immediately for the "nothing to save" case). Any feel as to how much of saving it would still be?
Cheers
-- Stuart