unix/minit

contrib/ctrlaltdel-run in master
Repositories | Summary | Log | Files | README | COPYING

ctrlaltdel-run (619B) download


 1#!/bin/sh
 2
 3# if umount -a fails give services additional time to shut down
 4fail(){
 5echo umount failed, try again.
 6sleep 1
 7sync
 8umount -a || sleep 3
 9}
10
11# Shut down "respawn" services - except getty/1.
12for i in `find /etc/minit -type f -name respawn | sed 's@/respawn$@@' | grep -v ^/etc/minit/getty/1$`;do
13 msvc -d "$i"
14done
15
16#send sigterm to all processes.
17/sbin/killall5 -15
18
19#send sighup to all processes.
20/sbin/killall5 -1
21
22sync
23# umount everything, mount "/" readonly
24/bin/umount -a || fail
25/sbin/swapoff -a
26
27# power down.
28# params should contain one of "RESTART", "HALT" or "POWER_OFF" 
29exec /sbin/hard-reboot $1
30