Automatic shutdown batch after server power off for WINDOWS

Source: Internet
Author: User


A project is in a new building, sometimes a power outage, and the temporary UPS can only spare 25-30 minutes and no management functions, before the arrival of the new ups, you need to rely on the following script to prevent loss of data lost power.

Of course, many ups do not have the COM port connection server Auto Power off function, this kind of UPS battery ran out or will cause the server off. You can also use this method to automatically shut down after a power outage.

The principle is simple, in the system to configure a scheduled task every 5 minutes, scheduled tasks to run the batch ping specified IP address, in order to avoid the wrong shutdown recommended at least 2 IP to detect, because after the power outage this IP can not ping (generally use the gateway, switch IP), shut down the host.

In this project, the scheduled task is configured on a 2008r2 Chinese version of the server, while the 3 switches of the ip:192.168.0.37, 192.168.0.38, 192.168.0.39 detection, when they can not ping, wait 10 minutes after the shutdown, Cancel shutdown if power is restored within 10 minutes!

Note: This method is not available for environments without UPS! Because different operating system return values may vary, batches may need to be modified to execute correctly. A little modification can also be implemented to turn off other services at the same time!


@echo offping/n 2/l 1 192.168.0.37|findstr "byte =1" && (goto OK) | | (ping/n 2/l 1 192.168.0.38|findstr "byte =1" && (goto OK) | | (ping/n 2/l 1 192.168.0.39|findstr "byte =1" && goto OK | | goto NG)): O kshutdown/aexit:ngshutdown/f/s/t 600exit


This article is from the "Le TripAdvisor" blog, please make sure to keep this source http://10811686.blog.51cto.com/10801686/1704222

Automatic shutdown batch after server power off for WINDOWS

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.