#!/sbin/sh
#@(#)HP Netstation Admin Scripts
#
# cknfs		Check if nfsd is running
#

$PSCMD | egrep -v pcnfs | egrep -v egrep | egrep nfsd > /dev/null
if [ $? -eq 0 ]
then
  echo
  echo "nfsd is running"
else
  echo
  echo "nfsd is not running"
  echo "Pleases consult your System Adminstration Documentation"
  echo "to determine how to enable this host as an NFS server."
  exit 90
fi


$PSCMD | egrep -v egrep | awk '{print $NF}' |  egrep mountd > /dev/null
if [ $? -eq 0 ]
then
  echo
  echo "mountd is running"
else
  echo
  echo "mountd is not running"
  echo "Pleases consult your System Adminstration Documentation"
  echo "to determine how to enable this host as an NFS server."
  exit 90
fi

getxtname "check (netgroup if applicable)"

if [ $? -ne 0 ]
then
  exit 90
fi


XTNAME=`cat $TMP/XTNAME | awk -F'.' '{print $1}'`
rm  $TMP/XTNAME

OKFLAG="notok"

if [ -f /usr/lib/X11/700X -o -d /usr/lib/X11/700X ]
then
  xtutil_can-mount $XTNAME /usr/lib/X11/700X
  if [ $? -eq 0 ]
  then
    echo
    echo Netstation seems to be allowed to mount
    echo /usr/lib/X11/700X/bin from this host.
    echo This is required for ENVIZEX and ENTRIA netstations.
    OKFLAG="ok"
  fi
fi

if [ -f /opt/hpxt/enware2/xthome -o -d /opt/hpxt/enware2/xthome ]
then
  xtutil_can-mount $XTNAME /opt/hpxt/enware2/xthome
  if [ $? -eq 0 ]
  then
    echo
    echo Netstation seems to be allowed to mount
    echo /opt/hpxt/enware2/xthome from this host
    echo This is required for ENVIZEX II and ENTRIA II netstations.
    OKFLAG="ok"
  fi
fi

if [ $OKFLAG = "notok" ]
then
  echo 
  echo  "This netstation seems to be allowed to mount neither"
  echo  "/opt/hpxt/enware2/xthome (required for ENVIZEX II and ENTRIA II) nor"
  echo  "/usr/lib/X11/700X/bin (required for ENVIZEX and ENTRIA)"
  echo
  exit 90
fi
exit 0
