2000-03-10 16:17:25 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2000-12-15 03:00:09 +03:00
|
|
|
# $NetBSD: rc.shutdown,v 1.5 2000/12/15 00:00:09 lukem Exp $
|
2000-03-10 16:17:25 +03:00
|
|
|
#
|
2000-12-15 03:00:09 +03:00
|
|
|
# rc.shutdown --
|
2000-03-10 16:17:25 +03:00
|
|
|
# Run the scripts in /etc/rc.d with reverse rcorder.
|
1998-10-29 23:24:56 +03:00
|
|
|
|
2000-12-15 03:00:09 +03:00
|
|
|
# System shutdown script run by shutdown(8) at system shutdown time.
|
|
|
|
# Note that halt(8) and reboot(8) do NOT invoke this script.
|
|
|
|
|
1998-10-29 23:24:56 +03:00
|
|
|
export HOME=/
|
2000-03-10 16:17:25 +03:00
|
|
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
1998-10-29 23:24:56 +03:00
|
|
|
|
2000-03-10 16:17:25 +03:00
|
|
|
. /etc/rc.subr
|
|
|
|
. /etc/rc.conf
|
1998-10-29 23:24:56 +03:00
|
|
|
|
2000-03-10 16:17:25 +03:00
|
|
|
if ! checkyesno do_rcshutdown; then
|
1998-10-29 23:24:56 +03:00
|
|
|
echo "Skipping shutdown hooks."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2000-03-10 16:17:25 +03:00
|
|
|
stty status '^T'
|
1998-10-29 23:24:56 +03:00
|
|
|
|
2000-03-10 16:17:25 +03:00
|
|
|
# Set shell to ignore SIGINT (2), but not children;
|
|
|
|
# shell catches SIGQUIT (3) and returns to single user.
|
|
|
|
#
|
|
|
|
trap : 2
|
|
|
|
trap "echo 'Shutdown interrupted.'; exit 1" 3
|
|
|
|
|
2000-07-17 19:23:28 +04:00
|
|
|
files=`rcorder -k shutdown /etc/rc.d/*`
|
2000-03-10 16:17:25 +03:00
|
|
|
for i in $files; do # reverse order of files
|
|
|
|
nfiles="$i $nfiles"
|
|
|
|
done
|
|
|
|
files=$nfiles
|
|
|
|
|
|
|
|
for i in $files; do
|
|
|
|
run_rc_script $i stop
|
|
|
|
done
|
1998-10-29 23:24:56 +03:00
|
|
|
|
2000-03-10 16:17:25 +03:00
|
|
|
date
|
1998-10-29 23:24:56 +03:00
|
|
|
exit 0
|