#!/bin/bash #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # Last version : 2024-12-04 #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # README ═══════════════════════════════════════════════════════════════════════════════════════════ # This script # - Duplicate TiNa backup in order to outsource data # - Ask for a range of backup (So, make full backup of all host) # - Copy backup on cartridges on pool "ANNUAL_OUTSOURCING" #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ━━━━━━━━━━━━━━━━━━━━━━━ # Usage help echo -e "\n ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" echo -e " ┃ Before lauch this script, make sure you have already made in TiNa All necessary FULL backup ┃" echo -e " ┃ ● USAGE: ./TiNa-Outsourcing.sh [RANGE-ID-JOB-START] [RANGE-ID-JOB-END] ┃" echo -e " ┃ ● EXAMPLE: ./TiNa-Outsourcing.sh 2742 2784 ┃" echo -e " ┃ > This script will lauch the command: ┃" echo -e " ┃ tina_job_control -jobid [StartID-EndID] -duplicate -pool "ANNUAL_OUTSOURCING" -empty_cart ┃" echo -e " ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n"
# ━━━━━━━━━━━━━━━━━━━━━━━ # Prompt for confirmation read -p "Do you want to proceed with this script? (yes/no): " confirmation
if [[ "$confirmation" != "yes" ]]; then echo -e "\nScript execution aborted by the user.\n" exit 0 fi
echo -e "\nContinuing with the script execution...\n"
# ━━━━━━━━━━━━━━━━━━━━━━━ # Check number of arguments if [ "$#" -ne 2 ]; then echo -e "Error: This script needs exactly 2 arguments.\n" exit 1 fi # Check if arguments are numbers if ! [[ "$1" =~ ^[0-9]+$ && "$2" =~ ^[0-9]+$ ]]; then echo -e "Error: Both arguments must be numeric.\n" exit 1 fi # Check if $1 < $2 if [ "$1" -ge "$2" ]; then echo -e "Error: The first argument must be less than the second argument.\n" exit 1 fi
# ━━━━━━━━━━━━━━━━━━━━━━━ # Launch duplication for dupjobs in $(seq "$1" "$2"); do
echo -e "\nProcessing Job ID: $dupjobs"
# Execute the TiNa command and capture its output output=$($YourTiNaPATH/Bin/tina_job_control -jobid "$dupjobs" -duplicate -pool "ANNUAL_OUTSOURCING" -empty_cart 2>&1) status=$?
# Print the captured output echo "$output"
# Check the command status if [ $status -eq 0 ]; then echo "Job ID $dupjobs: Duplication successful." else echo "Job ID $dupjobs: Duplication failed with errors." fi done
echo -e "\n\nDuplication process completed.\n\n"
Extraction
You can now extract cartridges with the tag “ANNUAL_OUTSOURCING” from your backup robot.
Documentation
MAN TiNa
Remerciements
Quentin E.
Merci à Quentin E. pour le complément d'informations
Quentin E.
Merci à Quentin E. pour le complément d'informations