Skip to content

Commit bc23387

Browse files
committed
Bug fixes
1 parent f396f38 commit bc23387

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: esxi-power-off-vms-without-tools.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ GRACE_PERIOD=3600
55

66
for VMID in `vim-cmd vmsvc/getallvms | awk '{ if (NR > 1) print $1 }'`
77
do
8-
vim-cmd vmsvc/power.getstate $VMID
9-
108
ON=`vim-cmd vmsvc/power.getstate $VMID | grep "Powered on" || EXIT=$?`
119
if [[ -n "$ON" ]]; then
1210
HB=`vim-cmd vmsvc/get.guestheartbeatStatus $VMID`
1311
if [ "$HB" != "green" ]; then
14-
UPTIME=`vim-cmd vmsvc/get.summary 259 | sed -rn 's/\ +uptimeSeconds\ =\ ([0-9]+),\ +/\1/p'`
12+
UPTIME=`vim-cmd vmsvc/get.summary $VMID | sed -rn 's/\ +uptimeSeconds\ =\ ([0-9]+),\ +/\1/p'`
1513
if [ "$UPTIME" -gt "$GRACE_PERIOD" ]; then
1614
echo "Powering off VM: $VMID"
17-
vim-cmd vmsvc/power.off $VMID
15+
vim-cmd vmsvc/power.off $VMID > /dev/null
1816
fi
1917
fi
2018
fi

0 commit comments

Comments
 (0)