ping检测网络连接
时间:2006-11-20 来源:ghbspecial
#!/bin/sh
#20061120 by ghb
datefile=`date +%Y%m%d`
pingwt=`ping -c 3 192.168.0.1`
pingdx=`ping -c 3 192.168.0.254`
wt=`ping -c 1 192.168.0.1|grep time|awk '{print $7}'|sed -n 1p|awk -F = '{print $1}'`
dx=`ping -c 1 192.168.0.77|grep time|awk '{print $7}'|sed -n 1p|awk -F = '{print $1}'` while true do
date=`date +%Y%m%d%T`
if [ $wt != "time" ]
then
echo "$date" >> /root/ping/tracewtfile_$datefile
echo "$pingwt" >> /root/ping/tracewtfile_$datefile
fi if [ $dx != "time" ]
then
echo "$date" >> /root/ping/tracewtfile_$datefile
echo "$pingdx" >> /root/ping/tracewtfile_$datefile
fi
sleep 10m
done
pingwt=`ping -c 3 192.168.0.1`
pingdx=`ping -c 3 192.168.0.254`
wt=`ping -c 1 192.168.0.1|grep time|awk '{print $7}'|sed -n 1p|awk -F = '{print $1}'`
dx=`ping -c 1 192.168.0.77|grep time|awk '{print $7}'|sed -n 1p|awk -F = '{print $1}'` while true do
date=`date +%Y%m%d%T`
if [ $wt != "time" ]
then
echo "$date" >> /root/ping/tracewtfile_$datefile
echo "$pingwt" >> /root/ping/tracewtfile_$datefile
fi if [ $dx != "time" ]
then
echo "$date" >> /root/ping/tracewtfile_$datefile
echo "$pingdx" >> /root/ping/tracewtfile_$datefile
fi
sleep 10m
done
相关阅读 更多 +