From 3249c1177d40e253026e1d7254249467cda1da89 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Fri, 26 Jan 2024 16:26:17 -0600 Subject: [PATCH] update --- esxi-scripts/get-snapshots.ps1 | 17 ++++++++++-- powerwall.sh | 51 ++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/esxi-scripts/get-snapshots.ps1 b/esxi-scripts/get-snapshots.ps1 index 1c1964dc..5615f76c 100755 --- a/esxi-scripts/get-snapshots.ps1 +++ b/esxi-scripts/get-snapshots.ps1 @@ -1,11 +1,22 @@ #!/usr/bin/env pwsh -Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null +# 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 $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null +Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | 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 \ No newline at end of file +Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false \ No newline at end of file diff --git a/powerwall.sh b/powerwall.sh index 2815cbb6..8dd16710 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -716,31 +716,34 @@ 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 + # 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 - 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 } GET_SNAPSHOTS_SUB(){