#!/bin/ksh
#
#ident	"@(#)hupctl.stf	1.6	04/12/15 SMI"
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Balchandra Vaidya
#
# Variables
prgdir=../prgs                  # program directory
maxwarn=80   
rhname=$1


#functions
cleanup()
{
	echo "hupctl ending!"
	kill -17 $txid
}

# Main
if [ $# -lt 4 ]
then
	#echo "!ERROR: $0 <ppp_client> <local_device_name> <remote_device_name> <baud_rate>"
	echo "!ERROR: $0 <rhname> <local_device_name> <remote_device_name> <baud_rate>"
	echo "!ERROR: $0 called with bad arguments."
	exit 1
fi

# SET LOGFILE FLAG FOR MAX WARNING COUNT
# This is checked by staf.eng, and if exceeded, staf.eng will kill this module.
echo "maxwarnings=${maxwarn}"

#ppp_client=$1
l_device=$2
r_device=$3
b_rate=$4

#ping $ppp_client 300
ping $rhname
if [ $? -ne 0 ]
then
	echo "!ERROR: Cannot ping ppp_client $ppp_client"
	exit 1
fi

#rsh $ppp_client "cd `pwd` ; env RUNTIME=$RUNTIME modem/bin/hupcli -d $r_device -b $b_rate >/dev/null &" &
rsh $rhname "cd `pwd` ; env RUNTIME=$RUNTIME modem/bin/hupcli -d $r_device -b $b_rate >/dev/null &" &

modem/bin/hupclo -d $l_device -b $b_rate



