rc.shutdown revision 62640
1#!/bin/sh 2# $FreeBSD: head/etc/rc.shutdown 62640 2000-07-05 12:40:26Z tg $ 3 4# Site-specific closing actions for daemons run by init on shutdown, 5# or before going single-user from multi-user. 6# Output and errors are directed to console by init, and the 7# console is the controlling terminal. 8 9stty status '^T' 10 11# Set shell to ignore SIGINT (2), but not children; 12# shell catches SIGQUIT (3) and returns to single user after fsck. 13trap : 2 14trap : 3 # shouldn't be needed 15 16HOME=/ 17PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin 18export HOME PATH 19 20# If there is a global system configuration file, suck it in. 21# 22if [ -r /etc/defaults/rc.conf ]; then 23 . /etc/defaults/rc.conf 24 source_rc_confs 25elif [ -r /etc/rc.conf ]; then 26 . /etc/rc.conf 27fi 28 29# Check if /var/db/mounttab is clean. 30case $1 in 31reboot) 32 if [ -f /var/db/mounttab ]; then 33 rpc.umntall 34 fi 35 ;; 36esac 37 38echo -n "Shutting down daemon processes: " 39 40# for each valid dir in $local_startup, search for init scripts matching *.sh 41case ${local_startup} in 42[Nn][Oo] | '') 43 ;; 44*) 45 for dir in ${local_startup}; do 46 if [ -d "${dir}" ]; then 47 for script in ${dir}/*.sh; do 48 if [ -x "${script}" ]; then 49 (set -T 50 trap 'exit 1' 2 51 ${script} stop) 52 fi 53 done 54 fi 55 done 56 echo . 57 ;; 58esac 59 60# Insert other shutdown procedures here 61 62echo '.' 63exit 0 64