From b14f0b98b3294220d3005b2bd61d03c0b825c41a Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 9 Dec 2023 19:37:57 -0600 Subject: [PATCH] update --- defaults.inc | 1 + powerwall.sh | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/defaults.inc b/defaults.inc index 9d7bc79d..78f19217 100755 --- a/defaults.inc +++ b/defaults.inc @@ -2,6 +2,7 @@ VERS='2.3.405-12092023' noheader=' update service dailytemp ' +hc_cw=65 # mqtt_conn='/usr/bin/mosquitto_sub -h 127.0.0.1 -u emonpi -P emonpimqtt' mqtt_conn='/usr/bin/mosquitto_sub -h 127.0.0.1 -u mqtt -P 12mqtt34password56' diff --git a/powerwall.sh b/powerwall.sh index f9153b09..a6af5d60 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -1475,7 +1475,9 @@ SHUTDOWN_SERVER(){ if [ "${ESXIHOST}" == "10.10.2.10" ]; then echo -e "${idsCL[LightYellow]}Since this is the iSCSI-PRI host server, all iSCSI-PRI VM's are being shutdown ... " for ehost in "${PW_MAINSITE_HOSTS[@]}"; do - echo -en "${idsCL[LightCyan]}Stopping iSCSI-PRI VM's on: ${PW_ESXI_HOST_NAMES[${ehost}]} [${ehost}] ... " + MSG="Stopping iSCSI-PRI VM's on: ${PW_ESXI_HOST_NAMES[${ehost}]} [${ehost}]" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ]; then ${PW_FOLDER}/esxi-scripts/iscsi-vm-shutdown.ps1 ${ehost} >/dev/null 2>&1 & echo -e "${idsCL[Green]}Commands sent${idsCL[Default]}" @@ -1489,7 +1491,9 @@ SHUTDOWN_SERVER(){ elif [ "${ESXIHOST}" == "10.10.2.17" ]; then echo -e "${idsCL[LightYellow]}Since this is the iSCSI-SYS host server, all iSCSI-SYS VM's are being shutdown ... " for ehost in "${PW_MAINSITE_HOSTS[@]}"; do - echo -en "${idsCL[LightCyan]}Stopping iSCSI-SYS VM's on: ${PW_ESXI_HOST_NAMES[${ehost}]} [${ehost}] ... " + MSG="Stopping iSCSI-SYS VM's on: ${PW_ESXI_HOST_NAMES[${ehost}]} [${ehost}]" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ]; then ${PW_FOLDER}/esxi-scripts/iscsi-sys-vm-shutdown.ps1 ${ehost} >/dev/null 2>&1 & echo -e "${idsCL[Green]}Commands sent${idsCL[Default]}" @@ -1502,7 +1506,9 @@ SHUTDOWN_SERVER(){ fi [ "${TEST}" != "true" ] && sleep 10s - echo -en "${idsCL[LightCyan]}Enabling maintenance mode & starting any iSCSI VM migrations needed ... " + MSG="Enabling maintenance mode & starting iSCSI VM migrations" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ]; then ${PW_FOLDER}/esxi-scripts/host-maintenance_mode.ps1 ${PW_VCENTER_HOST_NAMES[${ESXIHOST}]} >/dev/null 2>&1 & sleep 25s @@ -1511,7 +1517,9 @@ SHUTDOWN_SERVER(){ echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}" fi - echo -en "${idsCL[LightCyan]}Shutting down VM's ... " + MSG="Shutting down VM's" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ]; then run=$(${PW_FOLDER}/esxi-scripts/vm-shutdown.ps1 ${ESXIHOST} >/dev/null 2>&1) if [ "${ESXIHOST}" == "10.10.2.10" ] || [ "${ESXIHOST}" == "10.10.2.17" ]; then @@ -1528,7 +1536,9 @@ SHUTDOWN_SERVER(){ echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}" fi - echo -en "${idsCL[LightCyan]}Waiting for VM's to power off to shutdown '${PW_ESXI_HOST_NAMES[${ESXIHOST}]}' ... " + MSG="Waiting for VM's to power off to shutdown '${PW_ESXI_HOST_NAMES[${ESXIHOST}]}'" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ]; then MAINT_MODE_VERIFY_SHUTDOWN ${ESXIHOST} & echo -e "${idsCL[Green]}Continuing in background\n" @@ -1538,7 +1548,9 @@ SHUTDOWN_SERVER(){ if [ "${ESXIHOST}" == "10.10.2.10" ]; then - echo -en "${idsCL[LightCyan]}Waiting for Host ${host} (${ESXIHOST}) to shutdown ... " + MSG="Waiting for Host ${host} (${ESXIHOST}) to shutdown" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ]; then while ping -qw 10 -c3 "${ESXIHOST}">/dev/null 2>&1; do sleep 1; done echo -e "${idsCL[Green]}Done${idsCL[Default]}\n" @@ -1546,7 +1558,9 @@ SHUTDOWN_SERVER(){ echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}" fi - echo -en "${idsCL[LightCyan]}Powering off SAS Enclosure ... " + MSG="Powering off SAS Enclosure" + c=0; MSG_SPC=''; spc1=`expr ${hc_cw} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done + echo -en "${idsCL[LightCyan]}${MSG}${MSG_SPC}: " if [ "${TEST}" != "true" ] && [ "$(CHECK_HOST 10.10.2.10)" == "false" ]; then run=$(snmpset -v 1 -c private ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.14 i 2) sleep 3s