rc.shutdown revision 1.1
11.1Sbad#	$NetBSD: rc.shutdown,v 1.1 1998/10/29 20:24:57 bad Exp $
21.1Sbad
31.1Sbad# System shutdown script run by shutdown before halting/rebooting
41.1Sbad# or going single-user.
51.1Sbad
61.1Sbadstty status '^T'
71.1Sbad
81.1Sbadexport HOME=/
91.1Sbadexport PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
101.1Sbad
111.1Sbadif [ -f /etc/rc.subr ]; then
121.1Sbad	. /etc/rc.subr
131.1Sbadelse
141.1Sbad	echo "Can't read /etc/rc.subr; aborting."
151.1Sbad	exit 1;
161.1Sbadfi
171.1Sbad
181.1Sbadif [ -f /etc/rc.conf ]; then
191.1Sbad	. /etc/rc.conf
201.1Sbadfi
211.1Sbad
221.1Sbadif checkyesno do_rcshutdown; then
231.1Sbad	: # Everything's hunkdory
241.1Sbadelse
251.1Sbad	echo "Skipping shutdown hooks."
261.1Sbad	exit 0
271.1Sbadfi
281.1Sbad
291.1Sbadif [ -f /etc/rc.shutdown.local ]; then
301.1Sbad	. /etc/rc.shutdown.local
311.1Sbadfi
321.1Sbad
331.1Sbad# Kill xdm and wait for it to terminate.
341.1Sbadif checkyesno xdm; then
351.1Sbad	XDM_PID=`sed 1q /var/run/xdm-pid`
361.1Sbad	if [ -n "$XDM_PID" ]; then
371.1Sbad		echo -n ' xdm'
381.1Sbad		kill $XDM_PID
391.1Sbad		while kill -0 $XDM_PID; do
401.1Sbad			sleep 1
411.1Sbad		done
421.1Sbad	fi
431.1Sbadfi
441.1Sbad
451.1Sbadexit 0
46