Commit initial après suppression de l'historique

This commit is contained in:
lapatatedouce
2024-09-03 02:24:27 +02:00
commit 9f96c67463
6 changed files with 423 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#!/bin/bash
# This script initiates restoration requests for objects listed in a specified file.
# It requires the bucket name, file name, and the number of days for the restoration.
# Example usage:
# ./restore-glacier-objects.sh my-bucket object-list.txt 3
# (Initiates restoration for objects listed in 'object-list.txt' in 'my-bucket' for 3 days)
# Check the number of arguments
if [[ $# -ne 3 ]]; then
echo "Usage: $0 <bucket_name> <file_name> <number_of_days>"
exit 1
fi
# Retrieve arguments
BUCKET="$1"
FILE="$2"
DAYS="$3"
# Check if the file exists
if [[ ! -f "$FILE" ]]; then
echo "Error: The file '$FILE' does not exist."
exit 1
fi
# Iterate through the file and initiate restoration requests
while read -r KEY; do
aws s3api restore-object --restore-request Days=$DAYS --bucket $BUCKET --key "$KEY"
done < "$FILE"
echo "Restoration requests initiated for objects listed in '$FILE'."