:
#	@(#) rc0.sh 23.2 91/08/29 
#
#	Copyright (C) 1988-1991 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#
#	Copyright (c) 1984, 1986, 1987, 1988 AT&T
#	  All Rights Reserved

#	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
#	The copyright notice above does not evidence any
#	actual or intended publication of such source code.

#	"Run Commands" for init state 0
#	Leaves the system in a state where it is safe to turn off the power
#	or go to firmware.

a=`stty -g`	#save stty values for later restoration

echo 'The system is coming down.  Please wait.'

#	The following segment is for historical purposes.
#	There should be nothing in /etc/shutdown.d.
if [ -d /etc/shutdown.d ]
then
	for f in /etc/shutdown.d/*
	{
		if [ -s $f ]
		then
			/bin/sh ${f}
		fi
	}
fi
#	End of historical section

if [ -d /etc/rc0.d ]
then
	for f in /etc/rc0.d/K*
	{
		if [ -s ${f} ]
		then
			/bin/sh ${f} stop
		fi
	}

#	system cleanup functions ONLY (things that end fast!)	

	for f in /etc/rc0.d/S*
	{
		if [ -s ${f} ]
		then
			/bin/sh ${f} start
		fi
	}
fi
# PC 6300+ Style Installation - execute shutdown scripts from driver packages
if [ -d /etc/idsd.d ]
then
	for f in /etc/idsd.d/*
	{
		if [ -s ${f} ]
		then
			/bin/sh ${f}
		fi
	}
fi

trap "" 15
kill -15 -1
sleep 10
/etc/killall  9 2>/dev/null
sleep 10
sync;sync;sync
/etc/umountall
stty $a 2>/dev/null    #restore saved stty values
sync;  sync
echo '
The system is down.'
sync

