服务热线
#!/bin/bashping -c 2 192.168.1.111 > /dev/null
if [$? -ne 0 ] ;then service network restart
case $? in0) ipadress = ifconfig eth0 |grep "inet a " |cut -d: -f 2 |cut -d: " " -f 1
echo "success You get ip is ~$ipadress~" |mail root -s "success"
*)
echo "failed" |mail root -s "failed" esac
else
echo "You have ipaddress " |mail root -s "You have ipaddress"fi
备注:可以把此脚本放在linux开几启动运行,在运行此脚本前必要的要对dhcp自动获得ip进行适当的配置