VMware Cloud Community
espi3030
Expert
Expert
Jump to solution

ESX Shut Down Script

Hello All,

I have a scheduled power outage coming up, I have set up in the scheduled tasks shut down(s) for my VM's. Does any one have a script that will shut down the Hosts? Or is there a way to schedule that as well? Any help on this is greatly appreciated, thank you.

0 Kudos
1 Solution

Accepted Solutions
Texiwill
Leadership
Leadership
Jump to solution

Hello,

I am not sure I would put this into crontab. Mainly because crontab is a repetitive tool, i.e. if you forget to remove it every time this cronjob fires you will reboot your system. Small things like this can ruin your day.

If you must have a timed shutdown I suggest using http://mirror.centos.org/centos/3.6/os/i386/RedHat/RPMS/at-3.1.8-60_EL3.i386.rpm The 'at' command can specify a specific time to run a job and once done, is no longer there to run. One less thing to do. CentOS 3.6 is the closest to what is running within VI3.x. The 'at' rpm is safe to install. You can secure this by using 'echo root > /etc/at.allow' which will only allow root to use the at command.

Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education. As well as the Virtualization Wiki at

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill

View solution in original post

0 Kudos
6 Replies
demz
Expert
Expert
Jump to solution

Why not just simply place the shutdown command (e.g shutdown -h now) in the crontab ?

0 Kudos
Texiwill
Leadership
Leadership
Jump to solution

Hello,

I am not sure I would put this into crontab. Mainly because crontab is a repetitive tool, i.e. if you forget to remove it every time this cronjob fires you will reboot your system. Small things like this can ruin your day.

If you must have a timed shutdown I suggest using http://mirror.centos.org/centos/3.6/os/i386/RedHat/RPMS/at-3.1.8-60_EL3.i386.rpm The 'at' command can specify a specific time to run a job and once done, is no longer there to run. One less thing to do. CentOS 3.6 is the closest to what is running within VI3.x. The 'at' rpm is safe to install. You can secure this by using 'echo root > /etc/at.allow' which will only allow root to use the at command.

Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education. As well as the Virtualization Wiki at

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
espi3030
Expert
Expert
Jump to solution

Thank you Texiwill, I have downloaded the file you mentioned. How do I go about installing it? I'm not much of a Linux guy (still learning).

0 Kudos
rpartmann
Hot Shot
Hot Shot
Jump to solution

Hi,

rpm -i ps: Award points if you find answers helpful. Thanks.

ps: Award points if you find answers helpful. Thanks.
avaliulin
Enthusiast
Enthusiast
Jump to solution

you can install rpm package on esx server by copying this package to esx server

(I'm using WinSCP to do that - ),

then logging in to esx server via local console or ssh,

going to the folder you saved rpm package to,

and running the command:

rpm -i package_name.rpm

demz
Expert
Expert
Jump to solution

You're right Texiwill, 'at' is better in this case.

0 Kudos