Hi Folks
I have got a standalone host (ESX 4.1), hosting Virtual Center which is managing the host itself.
I want to automate restart of ESX host without using root credentials of ESX host.
Here is requirement
- Shutdown Virtual Center server hosted on server gracefully
- Reboot ESX host and bring back VC up
- I cant have ESX root password to connect to it (Some constraint)
- So I have to connect to VCenter and run my script, which requires me to use FORCE switch in restart-vmhost command
- I have come up with a bash script which is palced under /etc/init.d and have got a symlink to it at /etc/rc3.d
============
#chkconfig: 360 99 01
# description: Shutdown VM script
#!/bin/bash
date >> /var/log/vc_shut
for vm in $(vmware-cmd -l)
do
vmware-cmd $vm stop trysoft
done
RETVAL="0"
while [ "$RETVAL" -eq "0" ]; do
for vm in $(vmware-cmd -l)
do
vmware-cmd $vm getstate > /tmp/states
done
grep on /tmp/states > /dev/null
RETVAL=$?
done
date >> /var/log/vc_shut
=============
Problem is when I execute my Powershell script, it doesnt do a gracefull shutdown of server (I see in event logs showing unexpected shutdown)
Anybody got any experience around it, please advice
Thanks
Heera