minit

A small yet feature-complete init (http://fefe.de/minit/)
Log | Files | Refs | README | LICENSE

ctrlaltdel-run (619B)


      1 #!/bin/sh
      2 
      3 # if umount -a fails give services additional time to shut down
      4 fail(){
      5 echo umount failed, try again.
      6 sleep 1
      7 sync
      8 umount -a || sleep 3
      9 }
     10 
     11 # Shut down "respawn" services - except getty/1.
     12 for i in `find /etc/minit -type f -name respawn | sed 's@/respawn$@@' | grep -v ^/etc/minit/getty/1$`;do
     13  msvc -d "$i"
     14 done
     15 
     16 #send sigterm to all processes.
     17 /sbin/killall5 -15
     18 
     19 #send sighup to all processes.
     20 /sbin/killall5 -1
     21 
     22 sync
     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" 
     29 exec /sbin/hard-reboot $1
     30