cat ./network-reboot.sh
#!/bin/sh -
ScriptName=`basename $0`
PID=$$
PIDFile="/var/run/${ScriptName}.pid"
if [ -f $PIDFile ]; then
exit 0;
fi;
if [ "$1" != "start" ]; then
echo "`date` started" >> /var/log/${ScriptName}.log
$0 start &>/dev/null &2>/dev/null
exit 0;
fi;
trap "rm -f $PIDFile" 0 1 2 5 15
echo $PID > $PIDFile
sleep 30;
while true
do
sleep 90;
Req=`/usr/bin/curl -f --head --silent http://ya.ru/ | grep '200 Ok'`
if [ "$Req" = "" ]; then
echo "`date` reboot by timeout" >> /var/log/${ScriptName}.log
/sbin/ifconfig eth0 down
sleep 2
/sbin/ifconfig eth0 up
sleep 3
Req=`/usr/bin/curl -f --head --silent http://ya.ru/ | grep '200 Ok'`
echo "`date` eth0 up - [${Req}]" >> /var/log/${ScriptName}.log
sleep 30
/sbin/reboot
fi
done;
А разделить урл по слэшу - проблем нет.