#!/bin/sh
set -u  # force better programming and ability to use check for not set
if [ "${1:-}" = "-x" ] ; then set -xv; shift; fi

node=`uname -n| sed -e 's/\([^\.]\)\..*/\1/'`
gang=`gang`
case $gang in
  stken) robot="PowderHorn 9310"
          ;;
  cdfen) robot="PowderHorn 9310"
          ;;
   d0en*) robot=UNKNOWN
          ;;
       *) robot=UNKNOWN
          ;;
esac

output=${1:-/dev/tty}
if [ `echo $output | grep -c /dev/` -eq 0 ] ; then 
  rm -f $output
fi

if [ $node = "stkensrv4" ] ; then

cat << EOF >>$output
<html> <head> <title>$robot Drive Status Page</title> </head>
<body>
<body bgcolor="#ffffff" text=#a0a0ff">
<meta http-equiv="Refresh" content="360">
<h1><center>$robot Drive Status Fetch Begin: `date`</center><h1>
<hr>
<pre>
EOF

/usr/bin/rsh fntt -l acsss "echo query drive all |/export/home/ACSSS/bin/cmd_proc 2>> /tmp/garby" < /dev/null >>$output


######################################################################################Q

cat <<EOF >>$output
</pre>
<hr>
<h1><center>$robot Drive Status  Done : `date`</center><h1>
<hr>
</body>
EOF

else
  f=STKDrvStat.html
  rm /tmp/$f
  enrcp stkensrv4:$f /tmp/$f
  cat /tmp/$f >>$output
fi
