Update viewSnapshots

main
Anthony 2025-02-07 21:38:11 +08:00
parent 1e3cb351e8
commit a597b01b0b
2 changed files with 17 additions and 11 deletions

View File

@ -65,11 +65,13 @@ The **MB Backup Manager** is a comprehensive backup solution designed for managi
- Logs all scheduling actions
4. **Repository Maintenance** (`check_repo_stats.sh`):
- Retrieves repository statistics
- Applies retention policies (keeps last 7 backups by default)
- Performs integrity checks
- Removes stale locks
- Logs to `repo_stats_YYYY-MM-DD.log`
- Retrieves detailed repository statistics.
- Applies retention policies to manage snapshot storage:
- **Default Retention**: Keeps only the last 7 snapshots to balance storage usage and recovery needs.
- Forgotten snapshots are pruned to reclaim storage space.
- Performs repository integrity checks to ensure data consistency and reliability.
- Automatically detects and removes stale locks to prevent repository conflicts.
- Logs all actions and results to `repo_stats_YYYY-MM-DD.log` for traceability.
5. **Repository Validation** (`check_backup_repo.sh`):
- Validates repository integrity

View File

@ -58,7 +58,6 @@ fetch_available_tags() {
return 0
}
# Function: Validate repository access
# Function: Validate repository access
validate_repository() {
log_message "Validating repository access..."
@ -74,8 +73,8 @@ validate_repository() {
if ! RESTIC_PASSWORD=$(cat "$password_file") restic -r "$backupPath" snapshots &>/dev/null; then
# Attempt to fix permissions automatically
log_message "Attempting to fix permissions for '$backupPath'..."
sudo chown -R $(whoami):$(whoami) "$backupPath"
sudo chmod -R u+rw "$backupPath"
sudo chown -R "$(whoami)":"$(whoami)" "$backupPath"
sudo chmod -R u+rwX "$backupPath"
# Retry repository validation
if ! RESTIC_PASSWORD=$(cat "$password_file") restic -r "$backupPath" snapshots &>/dev/null; then
@ -93,8 +92,8 @@ fix_permissions() {
log_message "Checking permissions for '$backupPath'..."
if [ ! -r "$backupPath" ] || [ ! -w "$backupPath" ]; then
log_message "Fixing permissions for '$backupPath'..."
sudo chown -R $(whoami):$(whoami) "$backupPath"
sudo chmod -R u+rw "$backupPath"
sudo chown -R "$(whoami)":"$(whoami)" "$backupPath"
sudo chmod -R u+rwX "$backupPath"
fi
}
@ -133,7 +132,12 @@ main() {
fi
# Assign input argument
TAG=$1
TAG="$1"
# Map alias tags to show all snapshots
if [ "$TAG" == "full_backup" ] || [ "$TAG" == "everything" ]; then
TAG="all"
fi
# Validate environment and dependencies
validate_environment