Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report