#!/bin/ksh
#
#ident	"@(#)monitor_slice.sh	1.4	04/12/15 SMI"
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#


conf_file='/opt/SUNWstaf/config-util/config.s+h.info'
count=0
device=""
isdone=0
ms_status='/tmp/make_slices_status'
MS_ERROR=2

if [ -f conf_file ]
then
	echo "!Error: ${conf_file} does not exist."
fi

if [ -s ${ms_status} ]
then
	output=`cat ${ms_status}`
	echo "<br>$output"
	exit ${MS_ERROR}
fi
while read line
do
	device=`echo $line | awk '{print $1}'`
	for i in 's0' 's2'
	do
		mount | grep "/test.${device}$i">/dev/null
		if [ $? -eq 0 ]
		then
			echo "making slice /dev/dsk/${device}$i  ............. done.<br>"
		else
			ps -ef | grep mkfs | grep "${device}$i" > /dev/null
			if [ $? -eq 0 ]
			then
				echo "making slice /dev/dsk/${device}$i"
			fi
			isdone=1
		fi
	done
done <$conf_file

exit $isdone
