rc.shutdown revision 1.5
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
11export HOME=/
12export PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14. /etc/rc.subr
15. /etc/rc.conf
16
17if ! checkyesno do_rcshutdown; then
18	echo "Skipping shutdown hooks."
19	exit 0
20fi
21
22stty status '^T'
23
24#	Set shell to ignore SIGINT (2), but not children;
25#	shell catches SIGQUIT (3) and returns to single user.
26#
27trap : 2
28trap "echo 'Shutdown interrupted.'; exit 1" 3
29
30files=`rcorder -k shutdown /etc/rc.d/*`
31for i in $files; do			# reverse order of files
32	nfiles="$i $nfiles"
33done
34files=$nfiles
35
36for i in $files; do
37	run_rc_script $i stop
38done
39
40date
41exit 0
42