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