linux 网络测试脚本,linux检查网络状态脚本

 2023-09-16 阅读 19 评论 0

摘要:1,通过定时收发email检测网络连通性shell打开网页、#/bin/bashecho "Daily test mail" > state.txtmail -s Server_Stateabc@md1.21.co.jp< state.txtrm -df ./state.txt~crontab -e增加如下任务10 07 * * * /root/checkNKmail &分时日月周2,定时检测网

1,通过定时收发email检测网络连通性

shell打开网页、#/bin/bash

echo "Daily test mail" > state.txt

mail -s Server_Stateabc@md1.21.co.jp< state.txt

rm -df ./state.txt

~

crontab -e

增加如下任务

10 07 * * * /root/checkNKmail &

分时日月周

2,定时检测网络状态通过email发送

checkserverstat脚本内容:

#/bin/bash

echo "HZtelecomDNS" > state.txt

ping -c 5 202.101.172.35 >> state.txt

echo "

bJU" >> state.txt

ping -c 5 10.X.X.X  >> state.txt

echo "ADSL Gateway"  >>state.txt

ping -c 5 X.X.X.X  >> state.txt

echo "Server_Outside ×××"  >>state.txt

ping -c 5 192.168.2.100  >>state.txt

echo "Server_Outside WAN"  >> state.txt

ping -c 5 X.X.X.X  >> state.txt

echo "××× in company"  >> state.txt

ping -c 5 192.168.1.4  >>state.txt

echo "L2tp at aaa Libweb"  >>state.txt

ping -c 5 X.X.X.X & >>state.txt

mail -s Server_Stateadmin@abc.com

rm -df ./state.txt

~

crontab中增加任务

corntab -e

10 16 * * * /root/CheckWeatherState &

10 09 * * * /root/checkserverstate &

10 13 * * * /root/checkserverstate &

10 17 * * * /root/checkserverstate &

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/67222.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息