2
0
Fork 0

zio-backup: remove tags

main
Ducky 2022-02-23 05:36:36 +00:00
parent ac1714cb4a
commit eec9f19f9d
1 changed files with 9 additions and 15 deletions

View File

@ -23,14 +23,11 @@ function restic_exec() {
function backup() { function backup() {
path="$1" path="$1"
tag="$2" args="${@:2}"
args="${@:3}"
if [[ ! -d $path ]]; then if [[ ! -d $path ]]; then
warn "'$path' does not exist. Not backing up." warn "'$path' does not exist. Not backing up."
else else
tag="$host_$tag"
restic_exec \ restic_exec \
backup \ backup \
--iexclude "__MACOSX" \ --iexclude "__MACOSX" \
@ -48,21 +45,18 @@ function backup() {
--iexclude "tmp" \ --iexclude "tmp" \
--exclude-if-present ".nobackup" \ --exclude-if-present ".nobackup" \
--host "$host" \ --host "$host" \
--tag "$tag" \
$args "$path" $args "$path"
fi fi
} }
function forget() { function forget() {
tag="$1" path="$1"
tag="$host_$tag"
restic_exec \ restic_exec \
forget \ forget \
--host "$host" \ --host "$host" \
--keep-last 5 \ --keep-last 5 \
--tag "$tag" --path "$tag"
} }
function get_prop() { function get_prop() {
@ -137,9 +131,9 @@ do
done done
say_do "Backing up files..." say_do "Backing up files..."
backup /etc config backup /etc
backup /srv/store store backup /srv/store
backup /var variable backup /var
if [[ ! -z $post_script ]]; then if [[ ! -z $post_script ]]; then
say_do "Executing post-backup script..." say_do "Executing post-backup script..."
@ -147,6 +141,6 @@ if [[ ! -z $post_script ]]; then
fi fi
say_do "Removing old backups..." say_do "Removing old backups..."
forget config forget /etc
forget store forget /srv/store
forget variable forget /var