您的位置:首页 > 其它

自动关闭esxi主机及所有虚拟机

2013-01-02 13:32 561 查看
This script would be using two commands available on the esxi.

/sbin/powerOffVms (Stop the current’s running vms)

/bin/poweroff (Stop the Esx host)

I have called it: auto-shutdown.sh

----------

Details:

#! /bin/ash

echo "shutting down VMs..please wait.."

/sbin/powerOffVms

echo "done."

echo "shutting down the host now.."

/bin/poweroff

———-

Apply the execution’s rights :

chmod +x /vmfs/volumes/datastore1/auto-shutdown.sh

Add this script in /etc/rc.local

/bin/echo “0 22 * * * /vmfs/volumes/datastore1/auto-shutdown.sh” >> /var/spool/cron/crontabs/root

This script would stop the vms and the Esxi host everyday at 22h.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  自动关机 esxi