Hi
From unix (in this case Tru64, but the same on HP)
I use this script to call an HTTP PHP page.
I do this a lot, but in rare cases the telnet process hangs and takes 99.9% of the cpu.
This is the code that I'm using, one of the reasons for dooing it like this is the ability to do this from all unix servers without installing other applications.
Does anyone have ideers of what is happening? - and any fixes og workarounds?
Can I ex. put a timeout on the telnet session?
Thanks
LHG
From unix (in this case Tru64, but the same on HP)
I use this script to call an HTTP PHP page.
I do this a lot, but in rare cases the telnet process hangs and takes 99.9% of the cpu.
This is the code that I'm using, one of the reasons for dooing it like this is the ability to do this from all unix servers without installing other applications.
Code:
updateStatus ()
{
echo "Updating1"
if [ -z "$1" ]; then
echo "Update parm 1"
echo "Usage:"
echo "$0 var1=value1 ... varN=valueN"
exit
fi
port='80'
reciever='/prodlog/status/update.php'
host=testserv
retry=20
for i in $@; do
if [ -z "$params" ]; then
params=$i;
else
params=$params'&'$i
fi
echo "Updating parm"
done
cmd="GET $reciever?$params /HTTP/1.1\nHost: $host\n"
i=0
echo "while [ "$output" != "statusUpdate OK" -a $i -ne $retry ]"
while [ "$output" != "statusUpdate OK" -a $i -ne $retry ] ; do
let i=$i+1
output=`( echo open ${host} ${port}
sleep 1
echo ${cmd}
/bin/perl -e 'sleep .1'
echo
echo
/bin/perl -e 'sleep .1'
echo exit ) | telnet | grep statusUpdate ` 2> /dev/null
echo "UpdateReal " $i
echo $cmd
sleep 1;
done
output="done"
}
Does anyone have ideers of what is happening? - and any fixes og workarounds?
Can I ex. put a timeout on the telnet session?
Thanks
LHG