Compare commits
2 Commits
040f743ff0
...
2386cf6660
| Author | SHA1 | Date | |
|---|---|---|---|
| 2386cf6660 | |||
| 530cab685b |
@@ -133,6 +133,7 @@ sudo ufw allow from 192.168.4.6 to any proto udp port 1024:65535 comment "TCP AL
|
||||
sudo ufw allow from 192.168.4.7 to any proto tcp port 1024:65535 comment "UDP ALL for Sonos Roam"
|
||||
sudo ufw allow from 192.168.4.7 to any proto udp port 1024:65535 comment "TCP ALL for Sonos Roam"
|
||||
sudo ufw allow from ${NW} to any port 1883 comment "mqtt/mosquitto broker"
|
||||
sudo ufw allow from ${NW} to any port 8883 comment "mqtt/mosquitto broker (tls)"
|
||||
sudo ufw allow proto udp from ${NW} to any port 1900 comment "upnp/emby"
|
||||
sudo ufw allow proto udp from ${NW} to any port 1901 comment "upnp/sonos"
|
||||
sudo ufw allow proto udp from ${NW} port 1900 comment "upnp/response"
|
||||
|
||||
35
restore_all_copies_of_file.sh
Executable file
35
restore_all_copies_of_file.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# --- Configuration ---
|
||||
TAG="docker"
|
||||
SRC_PATH="/srv/docker/container/finplan/" # Path as it appears inside the backup
|
||||
SRC_FILE="finance.db" # Path as it appears inside the backup
|
||||
TARGET_DIR="/var/tmp/db_history" # Where to save the historical copies
|
||||
RESTIC_ARGS="-r /backup/restic-repo"
|
||||
export RESTIC_PASSWORD=backups-are-important
|
||||
# ---------------------
|
||||
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
# Get a list of snapshot IDs and timestamps in JSON format
|
||||
# Filtered for the specific file path to speed up the process
|
||||
snapshots=$(restic $RESTIC_ARGS find $SRC_FILE --tag $TAG --json)
|
||||
|
||||
# Loop through each snapshot using jq to parse the JSON
|
||||
echo "$snapshots" | jq -c '.[]' | while read -r snapshot; do
|
||||
snap_id=$(echo "$snapshot" | jq -r '.snapshot')
|
||||
snap_time=$(echo "$snapshot" | jq -r '.matches[0].mtime')
|
||||
|
||||
echo "$snap_id, $snap_time"
|
||||
|
||||
# Format date for the subdirectory (YY-MM-DD)
|
||||
dir_date=$(date -d "$snap_time" +"%y-%m-%d")
|
||||
|
||||
output_path="$TARGET_DIR/$dir_date"
|
||||
mkdir -p "$output_path"
|
||||
|
||||
# Restore the specific file to our dated subdirectory
|
||||
restic $RESTIC_ARGS dump "$snap_id" "$SRC_PATH/$SRC_FILE" > $output_path/$SRC_FILE
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user