rc.shutdown revision 1.2
1#	$NetBSD: rc.shutdown,v 1.2 1999/01/18 20:41:54 tron Exp $
2
3# System shutdown script run by shutdown before halting/rebooting
4# or going single-user.
5
6stty status '^T'
7
8export HOME=/
9export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
10
11if [ -f /etc/rc.subr ]; then
12	. /etc/rc.subr
13else
14	echo "Can't read /etc/rc.subr; aborting."
15	exit 1;
16fi
17
18if [ -f /etc/rc.conf ]; then
19	. /etc/rc.conf
20fi
21
22if checkyesno do_rcshutdown; then
23	: # Everything's hunkdory
24else
25	echo "Skipping shutdown hooks."
26	exit 0
27fi
28
29if [ -f /etc/rc.shutdown.local ]; then
30	. /etc/rc.shutdown.local
31fi
32
33# Kill xdm and wait for it to terminate.
34if checkyesno xdm; then
35	XDM_PIDFILE=`awk '/DisplayManager.pidFile/ {print $2}' \
36		     /usr/X11R6/lib/X11/xdm/xdm-config`
37	if [ -n "$XDM_PIDFILE" -a -e "$XDM_PIDFILE" ]
38	then
39		XDM_PID=`sed 1q $XDM_PIDFILE`
40		if [ -n "$XDM_PID" ]; then
41			echo -n ' xdm'
42			kill $XDM_PID
43			while kill -0 $XDM_PID 2>/dev/null; do
44				sleep 1
45			done
46			rm -f $XDM_PIDFILE
47		fi
48	fi
49fi
50
51exit 0
52