mb-backup-manager/scripts/imports/view_snapshots.sh

31 lines
865 B
Bash

#!/bin/bash
# Display usage if no tag is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <tag>"
echo "Available tags: main_backup, wordpress_db, core_files, media_themes, full_backup"
exit 1
fi
TAG=$1
backupPath='/mnt/backups'
# Embedded Restic repository password
RESTIC_PASSWORD="tonysite1" # Replace this with your actual password
export RESTIC_REPOSITORY="$backupPath"
export RESTIC_PASSWORD
# Validate the provided tag against known tags
case "$TAG" in
main_backup|wordpress_db|core_files|media_themes|full_backup)
# Use the --json flag to output the snapshots in JSON format
restic -r $RESTIC_REPOSITORY snapshots --tag "$TAG" --json
;;
*)
echo "Error: Unknown tag '$TAG'."
echo "Available tags: main_backup, wordpress_db, core_files, media_themes, full_backup"
exit 1
;;
esac