From 99ef0ab83ff951fba766c1e9eaeb7996904b8c6b Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Fri, 26 Jan 2024 16:33:11 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- esxi-scripts/get-snapshots.ps1 | 14 +------- powerwall.sh | 60 ++++------------------------------ 3 files changed, 8 insertions(+), 68 deletions(-) diff --git a/defaults.inc b/defaults.inc index cbb9c373..7de1e6ac 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ -VERS='2.5.160-01252024' +VERS='2.5.162-01262024' noheader=' update service dailytemp confsync -r -report ' diff --git a/esxi-scripts/get-snapshots.ps1 b/esxi-scripts/get-snapshots.ps1 index 5615f76c..36fb3be4 100755 --- a/esxi-scripts/get-snapshots.ps1 +++ b/esxi-scripts/get-snapshots.ps1 @@ -1,17 +1,5 @@ #!/usr/bin/env pwsh -# Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null -# . /opt/idssys/powerwall/settings.ps1 -# -# Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null -# -# get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb -# # get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb | ConvertTo-Json -Depth 1 -WarningAction:SilentlyContinue -# -# Disconnect-VIServer -Server $args[0] -Force –Confirm:$false - - - . /opt/idssys/powerwall/settings.ps1 Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | Out-Null @@ -19,4 +7,4 @@ Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Passwo get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb # get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb | ConvertTo-Json -Depth 1 -WarningAction:SilentlyContinue -Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false \ No newline at end of file +Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false diff --git a/powerwall.sh b/powerwall.sh index 8dd16710..c2a6f38e 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -715,63 +715,15 @@ LOGROTATE(){ } GET_SNAPSHOTS(){ - echo - # rm -f /tmp/.getsnaphots.* - # ncount=0 - # for SENSOR in ${PW_SENSOR_ORD[@]}; do - # if [ "${PW_HOST_ADDRESSES[${SENSOR}]}" != "" ]; then - # GET_SNAPSHOTS_SUB ${SENSOR} & - # ((ncount++)) - # fi - # done - # - # nc_count=0; completed=false - # until [ "${completed}" == "true" ]; do - # for snaphots in /tmp/.getsnaphots.*.done; do - # if [[ "${snaphots}" != *"*"* ]]; then - # snaphots_output=$(cat ${snaphots}) - # [ "${snaphots_output}" != "" ] && echo -e "${snaphots_output}\n" - # rm -f ${snaphots} - # ((nc_count++)) - # fi - # done - # if [ ${nc_count} -eq ${ncount} ]; then - # completed=true - # break - # fi - # sleep 2s - # done - - ${PW_FOLDER}/esxi-scripts/get-snapshots.ps1 + echo -e "\n${idsCL[Green]}ALL VCENTER VM SNAPHOTS ${idsCL[Default]}(minus replicas)" + DIVIDER . lightGreen 70 + echo -en "\n${idsCL[Green]}Connecting to vCenter and gathering snapshots ..." + snapshots=`${PW_FOLDER}/esxi-scripts/get-snapshots.ps1` + echo -en "\033[2K\e[0K\r" + echo -e "${snapshots}" echo } -GET_SNAPSHOTS_SUB(){ - SENSOR=${1} - ESXIHOST=${PW_HOST_ADDRESSES[${SENSOR}]} - tmpfile=/tmp/.getsnaphots.${SENSOR} - touch ${tmpfile}.running - echo -e "${idsCL[LightGreen]}${PW_ESXI_HOST_NAMES[${ESXIHOST}]} [${ESXIHOST}] " >> ${tmpfile}.running - DIVIDER . lightGreen 70 >> ${tmpfile}.running - snapshots=`${PW_FOLDER}/esxi-scripts/get-snapshots.ps1 ${ESXIHOST}` - - if [ "${snapshots}" != "" ]; then - echo -e "${snapshots}" >> ${tmpfile}.running - # for snapshot in $(echo ${snapshots} | jq -r '.[] | @base64'); do - # vm=`echo ${snapshot} | base64 --decode | jq -r '.VM'` - # name=`echo ${snapshot} | base64 --decode | jq -r '.Name'` - # created=`echo ${snapshot} | base64 --decode | jq -r '.Created'` - # size=`echo ${snapshot} | base64 --decode | jq -r '.SizeGB'` - # echo "$vm - $name - ${c}reated - $size" - # done - - else - # echo -e "\033[2K\e[0K\r No snapshots found" - echo -e " No snapshots found" >> ${tmpfile}.running - fi - DIVIDER true lightGreen 70 >> ${tmpfile}.running - mv ${tmpfile}.running ${tmpfile}.done -} CONFSYNC(){ rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@10.2.1.1:${PW_FOLDER}/ & >/dev/null 2>&1