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