423ba10303
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
61 lines
1.5 KiB
Text
61 lines
1.5 KiB
Text
--------------------------------------------------------------------------------
|
|
Shutting down the system
|
|
Nico Schotteilus, 2005-05-24 (last change: 2005-06-02)
|
|
--------------------------------------------------------------------------------
|
|
|
|
cinit will shutdown all running service exactly the reverted
|
|
way it started them.
|
|
|
|
1. What to do to allow a system to shutdown?
|
|
|
|
Create /etc/cinit/reboot, /etc/cinit/power-off and /etc/cinit/halt.
|
|
|
|
It's in most scenarios also enough to create only one of those
|
|
service directories and link all others against the first one:
|
|
|
|
[21:38] ei:cinit# mkdir /etc/cinit/power-off
|
|
[21:38] ei:cinit# ln -s power-off /etc/cinit/reboot
|
|
[21:38] ei:cinit# ln -s power-off /etc/cinit/halt
|
|
|
|
Then create the needed services, which are almost always:
|
|
|
|
- swapoff: disable swap
|
|
- sync: sync buffers to disk
|
|
- umount: umount everything
|
|
- remount: remount root read-only
|
|
|
|
|
|
on oder off?????
|
|
|
|
Add dependencies to
|
|
|
|
You can also use
|
|
What todo when shutting down (reboot, halt, poweroff) the system:
|
|
|
|
1. Cycle through service list and
|
|
while(processes--) {
|
|
Stop_current_processs
|
|
}
|
|
|
|
- Stop_current_processs
|
|
\ if(status = respawn)
|
|
| -> kill -TERM pid
|
|
| exec_svc(svc/off, svc/off.params)
|
|
|
|
kill remaining processes with SIGTERM
|
|
sleep(WAIT_KILL)
|
|
kill remaining processes with SIGKILL
|
|
sync;
|
|
umount(*)
|
|
|
|
reboot
|
|
|
|
|
|
- cycle through running services, kill them the other way round
|
|
- stop respawing processes
|
|
|
|
- start off-process of running services
|
|
- don't shutdown failed services
|
|
|
|
kill_svc(struct stat svc);
|
|
|