In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this article, the editor introduces in detail "how to automatically detect server downtime in Linux". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to automatically detect server downtime in Linux" can help you solve your doubts.
If you run the site, you may encounter some downtime. Sometimes, the Web server may shut down. It would be a very good thing if we could get an email when the server went down. We can easily schedule a Linux job, which periodically checks the status of the website and sends emails when problems arise.
The methods are as follows:
Step 1: create a script file named "downtime_detector.sh".
You can create this file in your home directory. Copy the following text to the script file you created.
If curl-s "http://www.programcreek.com/2016/08/leetcode-russian-doll-envelopes-java/" | grep-Q" Russian Doll Envelopes "then # if the keyword is in the content echo" the website is working fine "else echo" Program Creek Error "| / usr/sbin/sendmail youremail@gmail.comfi
The script checks whether the target web page contains the string "Russian Doll Envelopes". If the page contains a string, the page will render correctly. If not, a message is sent to the e-mail address.
Step 2: install "sendmail" on the Linux machine.
Sendmail is a popular and reliable tool that can be easily set up to send e-mail under Linux.
Sudo apt-get install sendmail step 3: create a cronjob.
Enter "crontab-e" to edit the cronjob list.
Append the following lines:
* / 5 * / path/to/script/downtime_detector.sh has finished the introduction of this article "how to detect server downtime automatically by Linux". If you want to grasp the knowledge points of this article, you still need to practice and use it. If you want to learn more about related articles, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.