setup new maintenance mode process

This commit is contained in:
2026-07-25 11:07:14 -05:00
parent f13ce07397
commit dc48f1a8af
3 changed files with 381 additions and 7 deletions
+9 -6
View File
@@ -273,7 +273,10 @@ SET_VM_SHUTDOWNTIMEOUT(){
}
MAINTENANCE_MODE(){
if ha-manager status | grep $(hostname) | grep "maintenance mode" &> /dev/null; then
local local_node
local_node="$(hostname -s)"
if ha-manager status | grep -F "$local_node" | grep -q "maintenance mode"; then
echo -en "${idsCL[LightCyan]}Take the local host out of maintenance mode (Y/n)?${idsCL[Default]} "
else
echo -en "${idsCL[LightCyan]}Put the local host into maintenance mode (Y/n)?${idsCL[Default]} "
@@ -282,12 +285,13 @@ MAINTENANCE_MODE(){
case "$choice" in
[Nn]) echo;;
*) echo
if ha-manager status | grep $(hostname) | grep "maintenance mode" &> /dev/null; then
ha-manager crm-command node-maintenance disable $(hostname) &
if ha-manager status | grep -F "$local_node" | grep -q "maintenance mode"; then
ha-manager crm-command node-maintenance disable "$local_node"
echo -e "\n${idsCL[Green]}This host will be taken out of maintenance mode${idsCL[Default]}\n"
else
ha-manager crm-command node-maintenance enable $(hostname) &
ha-manager crm-command node-maintenance enable "$local_node"
echo -e "\n${idsCL[Green]}This host will be entered into maintenance mode${idsCL[Default]}\n"
bash /opt/idssys/ta-proxmenu/inc/evacuate-proxmox-node.sh
fi
FINISH_ACTION
;;
@@ -375,7 +379,7 @@ MAIN_MENU() {
echo -e "${idsCL[DarkGray]} [S] ScreenConnect is already installed${idsCL[Default]}"
fi
echo
if ha-manager status | grep $(hostname) | grep "maintenance mode" &> /dev/null; then
if ha-manager status | grep -F "$(hostname -s)" | grep -q "maintenance mode"; then
echo -e "${idsCL[White]} [${idsCL[LightYellow]}M${idsCL[Default]}] ${idsCL[White]}Take Host out of Maintenance Mode${idsCL[Default]}"
else
echo -e "${idsCL[White]} [${idsCL[LightYellow]}M${idsCL[Default]}] ${idsCL[White]}Put Host into Maintenance Mode${idsCL[Default]}"
@@ -437,4 +441,3 @@ else
fi
exit 0