From 0e1d8873e4d665500a1e22fddd5f11a74065d05e Mon Sep 17 00:00:00 2001 From: nono Date: Mon, 5 Feb 2024 13:32:39 +0000 Subject: [PATCH] Actualiser Backup_OpenStack_Vms_And_Volumes.sh --- Backup_OpenStack_Vms_And_Volumes.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Backup_OpenStack_Vms_And_Volumes.sh b/Backup_OpenStack_Vms_And_Volumes.sh index 97c2a07..30993bf 100644 --- a/Backup_OpenStack_Vms_And_Volumes.sh +++ b/Backup_OpenStack_Vms_And_Volumes.sh @@ -188,42 +188,44 @@ function check_backup(){ _info " => Checking the backup of volumes" for BCK_VOLUME in "${BCK_VOLUMES_LIST[@]}" do + BCK_VOLUME_TODAY=${BCK_VOLUME}_${TODAY} RESULT=false while [ ! "$RESULT" = "true" ]; do - _info " Checking Backup for ${BCK_VOLUME} and waiting ${CHECK_FREQUENCY} secondes" + _info " Checking Backup for ${BCK_VOLUME_TODAY} and waiting ${CHECK_FREQUENCY} secondes" CURRENT_TIMESTAMP=`date +%s` if [ "$CURRENT_TIMESTAMP" -gt "$MAXIMUM_TIMESTAMP" ]; then - _err " Backup for ${BCK_VOLUME} verification time expired" + _err " Backup for ${BCK_VOLUME_TODAY} verification time expired" exit -1 fi - RESULT=$(${OPENSTACK} volume backup list -f json | jq -c '.[] | select(.Name | contains("'${BCK_VOLUME}'")) | .Status == "available"') + RESULT=$(${OPENSTACK} volume backup list -f json | jq -c '.[] | select(.Name | contains("'${BCK_VOLUME_TODAY}'")) | .Status == "available"') sleep ${CHECK_FREQUENCY} done - _info_action " Backup Volume ${BCK_VOLUME} is OK" + _info_action " Backup Volume ${BCK_VOLUME_TODAY} is OK" done echo "" _info " => Checking Backup Instance" for BCK_INSTANCE in "${BCK_INSTANCES_LIST[@]}" do + BCK_INSTANCE_TODAY=${BCK_INSTANCE}_${TODAY} RESULT=false while [ ! "$RESULT" = "true" ]; do - _info " Checking Backup for ${BCK_INSTANCE} and waiting 60 secondes" + _info " Checking Backup for ${BCK_INSTANCE_TODAY} and waiting 60 secondes" CURRENT_TIMESTAMP=`date +%s` if [ "$CURRENT_TIMESTAMP" -gt "$MAXIMUM_TIMESTAMP" ]; then - _err " Backup for ${BCK_INSTANCE} verification time expired" + _err " Backup for ${BCK_INSTANCE_TODAY} verification time expired" exit -1 fi - RESULT=`${OPENSTACK} image show ${BCK_INSTANCE} -f json | ${JQ} -r '.properties.image_state == "available" and .status == "active"'` + RESULT=`${OPENSTACK} image show ${BCK_INSTANCE_TODAY} -f json | ${JQ} -r '.properties.image_state == "available" and .status == "active"'` sleep 60 done - _info_action " Backup Instance ${BCK_INSTANCE} is OK" + _info_action " Backup Instance ${BCK_INSTANCE_TODAY} is OK" done }