This commit is contained in:
2023-12-15 08:20:05 -06:00
parent ef65cab082
commit e39ac13633
2 changed files with 17 additions and 29 deletions

View File

@@ -79,14 +79,10 @@ CHECK_SERVICES(){
}
SHUTDOWN_MAIN(){
if [ "${1}" == "ServerRoomTH" ] || [ "${1}" == "TEMP" ]; then
if [ "${1}" == "ServerRoomTH" ] || [ "${1}" == "TEMP" ] || [ "${1}" == "POWER" ]; then
touch ${PW_TMPFOLDER}/shutdown.MAIN.started
SHUTDOWN_SERVER main -esxi off
reason='Server Room Overheated!'
sendnotice=true
elif [ "${1}" == "POWER" ]; then
SHUTDOWN_SERVER main -esxi off
reason='Low Power!'
[ "${1}" == "POWER" ] && reason='Low Power!' || reason='Server Room Overheated!'
sendnotice=true
else
@@ -102,14 +98,15 @@ ${reason}" 1
echo
}
SHUTDOWN_SYS(){
if [ "${1}" == "ServerRoomTH" ] || [ "${1}" == "TEMP" ]; then
[ ! -f ${PW_TMPFOLDER}/shutdown.MAIN ] && SHUTDOWN_SERVER mainsite -esxi off || SHUTDOWN_SERVER sys -esxi off
reason='Server Room Overheated!'
sendnotice=true
elif [ "${1}" == "POWER" ]; then
[ ! -f ${PW_TMPFOLDER}/shutdown.MAIN ] && SHUTDOWN_SERVER mainsite -esxi off || SHUTDOWN_SERVER sys -esxi off
reason='Low Power!'
if [ "${1}" == "ServerRoomTH" ] || [ "${1}" == "TEMP" ] || [ "${1}" == "POWER" ]; then
if [ ! -f ${PW_TMPFOLDER}/shutdown.MAIN ]; then
touch ${PW_TMPFOLDER}/shutdown.MAINSITE.started
SHUTDOWN_SERVER mainsite -esxi off
else
touch ${PW_TMPFOLDER}/shutdown.SYS.started
SHUTDOWN_SERVER sys -esxi off
fi
[ "${1}" == "POWER" ] && reason='Low Power!' || reason='Server Room Overheated!'
sendnotice=true
else
@@ -117,7 +114,7 @@ SHUTDOWN_SYS(){
fi
if [ "${sendnotice}" == "true" ]; then
SENDNOTICE "SYS SERVERS SHUTDOWN" "SYS servers have been shutdown
SENDNOTICE "SYS/MAINSITE SERVERS SHUTDOWN" "SYS servers have been shutdown
${reason}" 1
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - SYS servers have been shutdown, ${reason}" >> ${PW_LOGFILE}
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}'F - Shutting down SYS servers" >> ${logtemp}
@@ -901,7 +898,7 @@ fi
iscsi-vm-shutdown)
[ "${2^^}" == "SYS" ] && ISCSISYSVMSHUTDOWN || ISCSIVMSHUTDOWN
;;
shutdownhost) SHUTDOWN_SERVER ${2} ${3} ${4} ${5};;
shutdown_server) SHUTDOWN_SERVER ${2} ${3} ${4} ${5};;
hostpower) HOSTPOWER ${2} ${3};;
host) HOSTMGMT ${2} ${3} ${4} ${5} ${6} ${7};;
@@ -1000,19 +997,10 @@ fi
echo -e " ${idsCL[Yellow]} -p|-power { on / off } ${idsCL[Default]}--> Controls Host Power"
echo -e " ${idsCL[Yellow]} -e|-esxi { off / mm } ${idsCL[Default]}--> Shuts down ESXi or puts into maintenance mode"
echo
# echo -e " ${idsCL[Yellow]}shutdownhost {host} ${idsCL[Default]}--> Shutdown ESXI host and its VMs"
# echo -e " ${idsCL[LightYellow]} host = {esxi-ip}, {idrac-ip}, {hostname} or {host-number;0-9}"
# echo
# echo -e " ${idsCL[LightCyan]}shutdown_servers${idsCL[Yellow]} {type} ${idsCL[Default]}--> Shutdown selection of servers"
# echo -e " ${idsCL[Yellow]} type = { main / sys / all }"
# echo
echo -e " ${idsCL[LightCyan]}iscsi-vm-shutdown${idsCL[Yellow]} {type} ${idsCL[Default]}--> Shutdown VM's running on iSCSI-(PRI or SYS) Datastore(s)"
echo -e " ${idsCL[Yellow]} type = { sys / main }"
echo -e " ${idsCL[Yellow]} sys='iSCSI-SYS' / main='iSCSI-PRI' ${idsCL[Default]}--> Defaults to main (iSCSI-PRI)"
echo
# echo -e " ${idsCL[Yellow]}hostpower {host} {on/off} ${idsCL[Default]}--> Control host chassis power"
# echo -e " ${idsCL[LightYellow]} host = {esxi-ip}, {idrac-ip}, {hostname} or {host-number;0-9}"
# echo
echo -e " ${idsCL[LightCyan]}service${idsCL[Yellow]} {srvc} {cmd} ${idsCL[Default]}--> Manage an individual monitor service"
echo -e " ${idsCL[Yellow]} srvc = { all / temp / power / powerlogger }"
echo -e " ${idsCL[Yellow]} cmd = { start / stop / restart / status }"