Two scripts for checking the linux Network Status

Source: Internet
Author: User

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 &

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.