rc.shutdown revision 1.3
11.3Slukem#!/bin/sh
21.3Slukem#
31.3Slukem# $NetBSD: rc.shutdown,v 1.3 2000/03/10 13:17:25 lukem Exp $
41.3Slukem#
51.3Slukem# rc.shutdown.sh --
61.3Slukem#	Run the scripts in /etc/rc.d with reverse rcorder.
71.1Sbad
81.1Sbadexport HOME=/
91.3Slukemexport PATH=/sbin:/bin:/usr/sbin:/usr/bin
101.1Sbad
111.3Slukem. /etc/rc.subr
121.3Slukem. /etc/rc.conf
131.1Sbad
141.3Slukemif ! checkyesno do_rcshutdown; then
151.1Sbad	echo "Skipping shutdown hooks."
161.1Sbad	exit 0
171.1Sbadfi
181.1Sbad
191.3Slukemstty status '^T'
201.1Sbad
211.3Slukem#	Set shell to ignore SIGINT (2), but not children;
221.3Slukem#	shell catches SIGQUIT (3) and returns to single user.
231.3Slukem#
241.3Slukemtrap : 2
251.3Slukemtrap "echo 'Shutdown interrupted.'; exit 1" 3
261.3Slukem
271.3Slukemfiles=`rcorder /etc/rc.d/*`
281.3Slukemfor i in $files; do			# reverse order of files
291.3Slukem	nfiles="$i $nfiles"
301.3Slukemdone
311.3Slukemfiles=$nfiles
321.3Slukem
331.3Slukemfor i in $files; do
341.3Slukem	run_rc_script $i stop
351.3Slukemdone
361.1Sbad
371.3Slukemdate
381.1Sbadexit 0
39