Linux Secure shutdown script

Source: Internet
Author: User
Linux security shutdown script determines the key purpose after 4 minutes of power failure: after the power is down, the server connects to the UPS, and the UPS can only support up to 5 minutes without power, so let's make a judgment here, if the power is down for 4 minutes, the mains will be shut down before it comes. The following two devices are two vrouters connected to mains, such as decisive... linux security shutdown script determines the key purpose after 4 minutes of power failure: after the power is down, the server connects to the UPS, and the UPS can only support up to 5 minutes without power, so let's make a judgment here, if the power is down for 4 minutes, the mains will be shut down before it comes. The following two devices are two vrouters connected to mains supply. if the two devices fail to be pinged, the server script considers the mains supply to be interrupted and shut down after 4 minutes. if one of them is different, the power supply will not be shut down. If one of the vrouters is connected within four minutes, the system determines that the mains is restored and the shutdown command is canceled .? Dest1 = 10.0.0.11dest2 = 10.0.0.12 #! /Bin/bash PATH =/sbin:/bin:/usr/sbin:/usr/bindest1 = 10.0.0.11dest2 = 10.0.0.12count = 0 while :; do sleep 5 for I in $ dest1 $ dest2 do ping-c1-w1 $ I &>/dev/null | (count ++ )) done if [$ count-lt 2]; then shutdown-c unset _ shut count = 0 else ["$ _ shut" = true] | {shutdown-h + 4 & _ shut = ture} fidone

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.