This commit is contained in:
2023-12-09 19:37:57 -06:00
parent d723fece49
commit b14f0b98b3
2 changed files with 22 additions and 7 deletions

View File

@@ -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'

View File

@@ -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