Home | History | Annotate | Line # | Download | only in etc
rc.shutdown revision 1.3
      1 #!/bin/sh
      2 #
      3 # $NetBSD: rc.shutdown,v 1.3 2000/03/10 13:17:25 lukem Exp $
      4 #
      5 # rc.shutdown.sh --
      6 #	Run the scripts in /etc/rc.d with reverse rcorder.
      7 
      8 export HOME=/
      9 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
     10 
     11 . /etc/rc.subr
     12 . /etc/rc.conf
     13 
     14 if ! checkyesno do_rcshutdown; then
     15 	echo "Skipping shutdown hooks."
     16 	exit 0
     17 fi
     18 
     19 stty status '^T'
     20 
     21 #	Set shell to ignore SIGINT (2), but not children;
     22 #	shell catches SIGQUIT (3) and returns to single user.
     23 #
     24 trap : 2
     25 trap "echo 'Shutdown interrupted.'; exit 1" 3
     26 
     27 files=`rcorder /etc/rc.d/*`
     28 for i in $files; do			# reverse order of files
     29 	nfiles="$i $nfiles"
     30 done
     31 files=$nfiles
     32 
     33 for i in $files; do
     34 	run_rc_script $i stop
     35 done
     36 
     37 date
     38 exit 0
     39