[CentOS] Run one-time startup script

Wed Sep 25 13:19:38 UTC 2013
Kai Schaetzl <maillists at conactive.com>

Kai Schaetzl wrote on Wed, 25 Sep 2013 13:00:19 +0200:

> Seems I have to use an init script 
> in rc0.d?

I tested the following:
/etc/rc.d/rc0.d/K000halt
/etc/rc.d/rc0.d/K99zhalt
/etc/rc.d/rc0.d/S000halt
/etc/rc.d/rc0.d/S999halt

Only /etc/rc.d/rc0.d/S000halt gets executed, e.g. the file that gets 
executed before killall and halt. Why don't the K* links get executed? 
There are lots of other K* files, obviously for a reason. When are they 
executed? (I mean I don't see that I could leave a level 0 state to enter 
another runlevel.)

It's not quite clear to me when S000halt gets executed. As I understand 
it's run when entering this runlevel and this runlevel is entered exactly 
when? At the very end of the shutdown after all daemons have been stopped? 
Basically the "state" of being shutdown or is it entered immediately after 
entering the shutdown command?

Kai