#! /bin/csh

set user=`whoami`

set req_user="comserv"
set bin_dir="/home/rtem/tnw/TriNetWatch1.0/bin"

set path=($bin_dir $path)

# not needded for linux
#setenv LD_LIBRARY_PATH /usr/local/lib:/usr/lib:/opt/local/lib

#echo "user = $user"

if $user != $req_user  then
        echo " You must su to the $req_user user to run this! "
        exit -1
endif

#echo " args = $#argv "

if $#argv != 3 then
        echo "GenericStartAgent agentname orb.config file.ini"
        exit -1
endif

set name=$1
set oc=$2
set ini=$3


echo "Starting $name agent"



# run it in an infinite loop as it will exit if the NSI host dies
# and the event channels disappear.


while (1)
        $name -ORBconfig $oc $ini 
        # the agent will only exit  if there is a serious problem or
        # if the Event Channels go down (indicating the NSI server crashed)
        sleep 60
end
