1 #!/bin/sh 2 # 3 # $NetBSD: rc.shutdown,v 1.5 2000/12/15 00:00:09 lukem Exp $ 4 # 5 # rc.shutdown -- 6 # Run the scripts in /etc/rc.d with reverse rcorder. 7 8 # System shutdown script run by shutdown(8) at system shutdown time. 9 # Note that halt(8) and reboot(8) do NOT invoke this script. 10 11 export HOME=/ 12 export PATH=/sbin:/bin:/usr/sbin:/usr/bin 13 14 . /etc/rc.subr 15 . /etc/rc.conf 16 17 if ! checkyesno do_rcshutdown; then 18 echo "Skipping shutdown hooks." 19 exit 0 20 fi 21 22 stty status '^T' 23 24 # Set shell to ignore SIGINT (2), but not children; 25 # shell catches SIGQUIT (3) and returns to single user. 26 # 27 trap : 2 28 trap "echo 'Shutdown interrupted.'; exit 1" 3 29 30 files=`rcorder -k shutdown /etc/rc.d/*` 31 for i in $files; do # reverse order of files 32 nfiles="$i $nfiles" 33 done 34 files=$nfiles 35 36 for i in $files; do 37 run_rc_script $i stop 38 done 39 40 date 41 exit 0 42