Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write batch processing that regularly checks whether a website is offline or not

Shulou Source: shulou.com Published: 2022-06-03 08:39:01 11月02日 Update

The main content of this article is "how to write batch processing to check whether the website is offline regularly". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to write batch processing that regularly checks whether the website is offline".

The following is the batch checktoreboot.bat written. The principle is to ping your domain name every hour on a regular basis, and restart the machine if it doesn't work.

@ echo checks every hour whether the host can Ping its own domain name, and if not, restart the machine. If you install firewall filtering, please consider other methods, or open the ICMP protocol.

@ echo checking.

@ echo off

Echo execute-date: > > c:\ checktoreboot.log

Date / t > > c:\ checktoreboot.log

Echo execute-time: > > c:\ checktoreboot.log

Time / t > > c:\ checktoreboot.log

Set hh=%time:~0,2%

Set / a hh + = 1

If / I% hh% GEQ 24 set / a hh = 0

At% hh%:00 C:\ CheckToReboot.bat

Ping-n 1 www.yourname.com | find "Request" & & shutdown-r

Echo = > > c:\ checktoreboot.log

@ echo on

@ echo check complete!

Then add Call CheckToReboot.bat to autoexec.bat

At this point, I believe you have a deeper understanding of "how to write batch processing to check whether the website is offline regularly". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Check website content domain name hour machine learning practical deeper host interest method principle practicality practical simple operation method more friends general rules Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Apple Redmi MariaDB Docker