开发者

What is a proper way of switching the servers and VMs off and on for power outage? [closed]

开发者 https://www.devze.com 2023-02-20 17:38 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question s开发者_JS百科o it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question s开发者_JS百科o it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

my organisation have two physical servers and some VMs. Currently when there is a pre-scheduled power outage, I use a script I wrote to loop through all VMs scheduling a shutdown command to all VMs and the servers. For example,

ssh root@${VMS[$i]} 'echo "shutdown -h now" | at 05:00am Mar 31'

Then I restart the machines when I am back to the office in the morning.

Is this the appropriate way of doing the auto shutdown? Do you do it differently? Thanks in advanced.


For starters, the shutdown command can take a time directly itself, you don't need to use at for that (see http://www.computerhope.com/unix/ushutdow.htm).

Beyond that, though, I don't see anything wrong with this approach, provided that your environment can tolerate those servers being offline potentially longer than necessary (i.e. if a power outage lasts from 9-10 pm, but you don't start them back up until 8 am the next morning, that's 10 hours longer that they were off than they really needed to be), which your description seems to suggest is the case. In this environment, I don't think I would do anything differently, beyond also scheduling the host computer to shutdown a couple of minutes after the VMs are scheduled to do so.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号