diff --git a/defaults.inc b/defaults.inc index 820ceec0..5068755e 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='2.7.71-07182024' +VERS='2.7.72-07232024' noheader=' update service dailytemp confsync -r -report test ' diff --git a/esxi-scripts/cooldown.overnight.ps1 b/esxi-scripts/cooldown.overnight.ps1 new file mode 100755 index 00000000..a2f9ca33 --- /dev/null +++ b/esxi-scripts/cooldown.overnight.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +. /opt/idssys/powerwall/settings.ps1 + +Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | Out-Null + +Get-VM | Where {$_.Name -like '*OMSA*' -or $_.Name -like '*RustDesk Server*' -or $_.Name -like '*MySQL-Manager*' | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*Offsite-Backups*'} | Shutdown-VMGuest -Confirm:$false + +Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false + + + + + + + + + + + + + + + + + + + + diff --git a/esxi-scripts/coolup.overnight.ps1 b/esxi-scripts/coolup.overnight.ps1 new file mode 100755 index 00000000..13ee989d --- /dev/null +++ b/esxi-scripts/coolup.overnight.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +. /opt/idssys/powerwall/settings.ps1 + +Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | Out-Null + +Get-VM | Where {$_.Name -like '*OMSA*' -or $_.Name -like '*RustDesk Server*' -or $_.Name -like '*MySQL-Manager*' | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*Offsite-Backups*'} | Start-VM -Confirm:$false + +Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false + + + + + + + + + + + + + + + + + + + + diff --git a/powerwall.sh b/powerwall.sh index 87bda5da..5f23ee67 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -167,7 +167,21 @@ COOLDOWN_SRVRM(){ SHUTDOWN_SERVER 10.10.2.10 -esxi off ${PW_FOLDER}/esxi-scripts/set-drs.ps1 2 } - +COOLDOWN_SRVRM_OVERNIGHT(){ + if [ "${1}" == "OFF" ]; then + ${PW_FOLDER}/esxi-scripts/cooldown.overnight.ps1 + sleep 20 + SHUTDOWN_SERVER 10.10.2.16 -esxi off + sleep 90 + ${PW_FOLDER}/esxi-scripts/set-drs.ps1 2 + + elif [ "${1}" == "ON" ]; then + SHUTDOWN_SERVER 10.10.2.16 -power on + sleep 600 + ${PW_FOLDER}/esxi-scripts/coolup.overnight.ps1 + fi + +} MAINT_MODE_VERIFY_SHUTDOWN(){ ESXIHOST=${1} MaintMode="" @@ -1032,6 +1046,7 @@ fi dl|downlist) DOWNLIST;; cooldown) COOLDOWN_SRVRM;; + cooldown-overnight) COOLDOWN_SRVRM_OVERNIGHT;; oldhelp) echo -e "${idsCL[White]} Usage: ${idsCL[LightYellow]}[powerwall or pw]${idsCL[LightCyan]} {option}"