52 lines
995 B
Plaintext
52 lines
995 B
Plaintext
# $NetBSD: rc.shutdown,v 1.2 1999/01/18 20:41:54 tron Exp $
|
|
|
|
# System shutdown script run by shutdown before halting/rebooting
|
|
# or going single-user.
|
|
|
|
stty status '^T'
|
|
|
|
export HOME=/
|
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
|
|
|
|
if [ -f /etc/rc.subr ]; then
|
|
. /etc/rc.subr
|
|
else
|
|
echo "Can't read /etc/rc.subr; aborting."
|
|
exit 1;
|
|
fi
|
|
|
|
if [ -f /etc/rc.conf ]; then
|
|
. /etc/rc.conf
|
|
fi
|
|
|
|
if checkyesno do_rcshutdown; then
|
|
: # Everything's hunkdory
|
|
else
|
|
echo "Skipping shutdown hooks."
|
|
exit 0
|
|
fi
|
|
|
|
if [ -f /etc/rc.shutdown.local ]; then
|
|
. /etc/rc.shutdown.local
|
|
fi
|
|
|
|
# Kill xdm and wait for it to terminate.
|
|
if checkyesno xdm; then
|
|
XDM_PIDFILE=`awk '/DisplayManager.pidFile/ {print $2}' \
|
|
/usr/X11R6/lib/X11/xdm/xdm-config`
|
|
if [ -n "$XDM_PIDFILE" -a -e "$XDM_PIDFILE" ]
|
|
then
|
|
XDM_PID=`sed 1q $XDM_PIDFILE`
|
|
if [ -n "$XDM_PID" ]; then
|
|
echo -n ' xdm'
|
|
kill $XDM_PID
|
|
while kill -0 $XDM_PID 2>/dev/null; do
|
|
sleep 1
|
|
done
|
|
rm -f $XDM_PIDFILE
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 0
|