I have a nice little script that i have written in Perl, in it use RSH ( yes i know it is i should being using ssh, but it i secure network it is being run on) the idea of the script it that it will RSH into a machine and then follow out a command, the problem i am running into is if the RSH deamon for what ever reason as stopped working on the machine, the script will keep trying to accsess the machine for a few mins and then move onto the next, is there a way to add a timeout, so if the connect is not made in say 30 seconds it will move on
I would try to do the following (Im a beginner ) -
CHK=`ssh2 -q <IP> "ps -ef | grep rshd | grep -v grep"`
if [ $CHK -eq 0 ]; then
sleep 30
CHK=`ssh2 -q <IP> "ps -ef | grep rshd | grep -v grep"`
if [ $CHK -ne 0 ];then
//call your script here
else
//rshd in remote sys is not up
//do what you want to
fi
else
//rshd running - call your script here too
fi