#! /usr/bin/sh

##############################################################################
#
# Copyright (c) Agilent Technologies 2000.  All rights reserved.
#
# THIS SOFTWARE IS FOR THE USE OF TRAINED AGILENT PERSONNEL ONLY to install and
# support customers system.  The presence of this software on customer's
# system does not grant customer any license, ownership or other rights in 
# this software or imply any degree of support for this software from Agilent.
# Agilent may remove this software at any time.
#
# AGILENT TECHNOLOGIES MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFTWARE,
# INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE.  Agilent Technologies shall not be liable
# for errors contained herein or direct, indirect, special, incidental, or 
# consequential damages in connection with furnishing, performance, or use of
# this software.
#
# RESTRICTED RIGHTS LEGEND  Use, duplication or disclosure by US Government is
# subject to restrictions as set forth in subdivision (c)(1)(ii) of the 
# Rights in Technical Data and Computer Software Clause 252.227.7013.
# Agilent Technologies.
#
############################################################################# 
# Author: Allan Kerr, CSG Consultant

if test "$(id -u)" -ne 0
then
  echo "ERROR: must be run as root for remsh to work"
  exit 1
fi

P7SERVER=m7server

alive=$(/etc/ping $P7SERVER -n 1 |\
        sed -n -e '/received/ s/^[^,]*, *\([0-9]*\).*$/\1/p')
if test "$alive" = 1
then
  remsh $P7SERVER -n /opt/platform7/bin/p7dumpstatus c32.run 2>&1 >/dev/null
  sleep 5
  remsh $P7SERVER -n cat /var/opt/platform7/tmp/eng_logging_C32_0 | \
        /usr/contrib/bin/p7commsstatus $@
else
  echo "ERROR: central server $P7SERVER does not respond to a network ping"
fi

exit 0

