rc.shutdown revision 1.5
11.3Slukem#!/bin/sh 21.3Slukem# 31.5Slukem# $NetBSD: rc.shutdown,v 1.5 2000/12/15 00:00:09 lukem Exp $ 41.3Slukem# 51.5Slukem# rc.shutdown -- 61.3Slukem# Run the scripts in /etc/rc.d with reverse rcorder. 71.5Slukem 81.5Slukem# System shutdown script run by shutdown(8) at system shutdown time. 91.5Slukem# Note that halt(8) and reboot(8) do NOT invoke this script. 101.1Sbad 111.1Sbadexport HOME=/ 121.3Slukemexport PATH=/sbin:/bin:/usr/sbin:/usr/bin 131.1Sbad 141.3Slukem. /etc/rc.subr 151.3Slukem. /etc/rc.conf 161.1Sbad 171.3Slukemif ! checkyesno do_rcshutdown; then 181.1Sbad echo "Skipping shutdown hooks." 191.1Sbad exit 0 201.1Sbadfi 211.1Sbad 221.3Slukemstty status '^T' 231.1Sbad 241.3Slukem# Set shell to ignore SIGINT (2), but not children; 251.3Slukem# shell catches SIGQUIT (3) and returns to single user. 261.3Slukem# 271.3Slukemtrap : 2 281.3Slukemtrap "echo 'Shutdown interrupted.'; exit 1" 3 291.3Slukem 301.4Slukemfiles=`rcorder -k shutdown /etc/rc.d/*` 311.3Slukemfor i in $files; do # reverse order of files 321.3Slukem nfiles="$i $nfiles" 331.3Slukemdone 341.3Slukemfiles=$nfiles 351.3Slukem 361.3Slukemfor i in $files; do 371.3Slukem run_rc_script $i stop 381.3Slukemdone 391.1Sbad 401.3Slukemdate 411.1Sbadexit 0 42