#!/bin/bash
neteth0=`/sbin/mii-tool eth0|awk ‘{print $5}‘`
neteth1=`/sbin/mii-tool eth1|awk ‘{print $5}‘`
if [[ $neteth0 == "ok" ]] || [[ $neteth1 == "ok" ]]; then
echo "Network is ok" >> /var/log/ha-net.log
echo "network good"
else [[ $neteth0 != "ok" ]] && [[ $neteth1 != "ok" ]]
echo "Network is down!" >> /var/log/ha-net.log
fi
sleep 5
注:在计划任务中,mii-tool需要加绝对路径,/sbin/mii-tool
时间: 2024-10-21 10:23:41