#!/bin/sh
#@(#)sds.info	1.5 17:31:21


# If SDS is not present don't run these tests.

if test ! -x /usr/opt/SUNWmd/sbin/metastat
then
    exit
fi


/usr/bin/mkdir disks/sds

# get local, i.e. non-disk sets info.
/usr/opt/SUNWmd/sbin/metastat    > disks/sds/metastat.out
/usr/opt/SUNWmd/sbin/metastat -p > disks/sds/metastat-p.out
/usr/opt/SUNWmd/sbin/metadb > disks/sds/metadb.out


# The first test makes sure we have metaset executable (SDS pre 4.0
# may not have disk sets option); The second test checks for the
# existens of disk sets, if no disk sets exist then exit.
if  test ! -x  /usr/opt/SUNWmd/sbin/metaset     ||
    test  "`/usr/opt/SUNWmd/sbin/metaset`" = ""
then
    exit
fi

# run the test for each disk set found.
for diskset in `/usr/opt/SUNWmd/sbin/metaset|/usr/bin/grep "Set name" | /usr/bin/awk '{print $4}' | /usr/bin/sed s/,.*//`
do
    metaparam="-s"$diskset
    /usr/opt/SUNWmd/sbin/metastat $metaparam 1>disks/sds/metastat.$diskset.out 2>&1
    /usr/opt/SUNWmd/sbin/metastat $metaparam -p 1>disks/sds/metastat-p.$diskset.out 2>&1
    /usr/opt/SUNWmd/sbin/metadb  $metaparam 1>disks/sds/metadb.$diskset.out 2>&1
    /usr/opt/SUNWmd/sbin/metaset $metaparam 1>disks/sds/metaset.$diskset.out 2>&1
done
