<commit_before>#!/bin/sh
# ESXi 5.1 host automated shutdown script

# these are the VM IDs to shutdown in the order specified
# use the SSH shell, run "vim-cmd vmsvc/getallvms" to get ID numbers
# specify IDs separated by a space
SERVERIDS=`vim-cmd vmsvc/getallvms | awk 'BEGIN {getline}; { print $1 }'`

# New variable to allow script testing, assuming the vim commands all work to issue shutdowns
# can be "0" or "1"
TEST=0

# script waits WAIT_TRYS times, WAIT_TIME seconds each time
# number of times to wait for a VM to shutdown cleanly before forcing power off.
WAIT_TRYS=20

# how long to wait in seconds each time for a VM to shutdown.
WAIT_TIME=10

# ------ DON'T CHANGE BELOW THIS LINE ------

validate_shutdown()
{
    vim-cmd vmsvc/power.getstate $SRVID | grep -i "off" > /dev/null 2<&1
    STATUS=$?

    if [ $STATUS -ne 0 ]; then<commit_msg>change query to get ids of the machines to support annotations on machines<commit_after>#!/bin/sh
# ESXi 5.1 host automated shutdown script

# these are the VM IDs to shutdown in the order specified
# use the SSH shell, run "vim-cmd vmsvc/getallvms" to get ID numbers
# specify IDs separated by a space
SERVERIDS=$(vim-cmd vmsvc/getallvms | sed -e '1d' -e 's/ \[.*$//' | awk '$1 ~ /^[0-9]+$/ {print $1}')

# New variable to allow script testing, assuming the vim commands all work to issue shutdowns
# can be "0" or "1"
TEST=0

# script waits WAIT_TRYS times, WAIT_TIME seconds each time
# number of times to wait for a VM to shutdown cleanly before forcing power off.
WAIT_TRYS=20

# how long to wait in seconds each time for a VM to shutdown.
WAIT_TIME=10

# ------ DON'T CHANGE BELOW THIS LINE ------

validate_shutdown()
{
    vim-cmd vmsvc/power.getstate $SRVID | grep -i "off" > /dev/null 2<&1
    STATUS=$?

    if [ $STATUS -ne 0 ]; then
{'fraction_non_alphanumeric': 0.10716268739589117, 'fraction_numerical': 0.01665741254858412, 'mean_word_length': 3.4714640198511164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6735660', 'n_tokens_mistral': 645, 'n_tokens_neox': 587, 'n_words': 258}