1. Check network connectivity through timed sending and receiving email
 
Copy codeThe Code is as follows: #/bin/bash 
Echo "Daily test mail"> state.txt 
Mail-s Server_State abc@jbxue.com <state.txt 
Rm-df./state.txt 
~
Crontab-e
Add the following task
10 07 ***/root/checkNKmail &
Time-sharing day-month week
 
2. timed detection of network status sent by email
 
Checkserverstat script content:
 
Copy codeThe Code is as follows: #/bin/bash 
Echo "HZtelecomDNS"> state.txt 
Ping-c 5 202.101.172.35> state.txt 
Echo" 
BJU "> state.txt 
Ping-c 5 10. X> state.txt 
Echo "ADSL Gateway"> state.txt 
Ping-c 5 X. X> state.txt 
Echo "Server_Outside VPN"> state.txt 
Ping-c 5 192.168.2.100> state.txt 
Echo "Server_Outside WAN"> state.txt 
Ping-c 5 X. X> state.txt 
Echo "VPN 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 &> state.txt 
Mail-s Server_State admin@abc.com <state.txt 
Rm-df./state.txt 
Add a task to crontabCopy codeThe Code is as follows: corntab-e
10 16 ***/root/CheckWeatherState &
10 09 ***/root/checkserverstate &
10 13 ***/root/checkserverstate &
10 17 ***/root/checkserverstate &