rc.shutdown revision 62640
127837Sdavidn#!/bin/sh 250472Speter# $FreeBSD: head/etc/rc.shutdown 62640 2000-07-05 12:40:26Z tg $ 327837Sdavidn 451231Ssheldonh# Site-specific closing actions for daemons run by init on shutdown, 527837Sdavidn# or before going single-user from multi-user. 627837Sdavidn# Output and errors are directed to console by init, and the 727837Sdavidn# console is the controlling terminal. 827837Sdavidn 927837Sdavidnstty status '^T' 1027837Sdavidn 1127837Sdavidn# Set shell to ignore SIGINT (2), but not children; 1227837Sdavidn# shell catches SIGQUIT (3) and returns to single user after fsck. 1327837Sdavidntrap : 2 1427837Sdavidntrap : 3 # shouldn't be needed 1527837Sdavidn 1651231SsheldonhHOME=/ 1727837SdavidnPATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin 1851231Ssheldonhexport HOME PATH 1927837Sdavidn 2062640Stg# If there is a global system configuration file, suck it in. 2162640Stg# 2262640Stgif [ -r /etc/defaults/rc.conf ]; then 2362640Stg . /etc/defaults/rc.conf 2462640Stg source_rc_confs 2562640Stgelif [ -r /etc/rc.conf ]; then 2662640Stg . /etc/rc.conf 2762640Stgfi 2862640Stg 2953550Sdillon# Check if /var/db/mounttab is clean. 3053550Sdilloncase $1 in 3153550Sdillonreboot) 3253550Sdillon if [ -f /var/db/mounttab ]; then 3353550Sdillon rpc.umntall 3453550Sdillon fi 3553550Sdillon ;; 3653550Sdillonesac 3753550Sdillon 3851231Ssheldonhecho -n "Shutting down daemon processes: " 3927837Sdavidn 4062640Stg# for each valid dir in $local_startup, search for init scripts matching *.sh 4162640Stgcase ${local_startup} in 4262640Stg[Nn][Oo] | '') 4362640Stg ;; 4462640Stg*) 4562640Stg for dir in ${local_startup}; do 4662640Stg if [ -d "${dir}" ]; then 4762640Stg for script in ${dir}/*.sh; do 4862640Stg if [ -x "${script}" ]; then 4962640Stg (set -T 5062640Stg trap 'exit 1' 2 5162640Stg ${script} stop) 5262640Stg fi 5362640Stg done 5462640Stg fi 5562640Stg done 5662640Stg echo . 5762640Stg ;; 5862640Stgesac 5927837Sdavidn 6062640Stg# Insert other shutdown procedures here 6127837Sdavidn 6227837Sdavidnecho '.' 6327837Sdavidnexit 0 64