#!/bin/sh
while true
do
ping -c1 -W1 192.168.56.100 > /dev/null
if [[ $? != 0 ]];then
date >> /tmp/`hostname`.ping.out
echo "ping 192.168.56.100 failed." >> /tmp/`hostname`.ping.out
else
date >> /tmp/`hostname`.ping.out
echo "ping 192.168.56.100 success." >> /tmp/`hostname`.ping.out
fi
sleep 1
done

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux