From e874996577994c98f8c1ef033173aae32b77539e Mon Sep 17 00:00:00 2001 From: snaki Date: Tue, 31 May 2022 13:47:52 +0200 Subject: [PATCH] updated names --- btrbk | 10 +++++----- config.sh => btrbk.conf | 0 install.sh | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) rename config.sh => btrbk.conf (100%) diff --git a/btrbk b/btrbk index 9d11a5c..8c1b1d1 100755 --- a/btrbk +++ b/btrbk @@ -1,6 +1,6 @@ #!/bin/bash -source config.sh +source /etc/btrbk.conf startDate=$(date +%s) function bkRun { @@ -19,11 +19,11 @@ function bkRun { btrfs subvolume snapshot -r ${SUBVOLS[$i]} $SNAPDIR$snapName sync fi - if [[ -d "$snapLast" && $1 = "daily" ]]; then + if [[ -d "$snapLast" && $1 = "incremental" ]]; then btrfs send -p $snapLast $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month"-incr/"$snapName.pgp else btrfs send $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month"-full/"$snapName.pgp - if [[ $1 = "monthly" ]] && rclone ls $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr; then + if [[ $1 = "full" ]] && rclone ls $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr; then rclone delete $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr/ if rclone ls $RCLONEDIR$(date -d "$date -2 month" +%Y-%B)-full/; then rclone delete $RCLONEDIR$(date -d "$date -2 month" +%Y-%B)-full/ @@ -40,9 +40,9 @@ function bkRun { function testDate { if [ `date +%d` != "01" ]; then - bkRun "daily" + bkRun "incremental" else - bkRun "monthly" + bkRun "full" fi } diff --git a/config.sh b/btrbk.conf similarity index 100% rename from config.sh rename to btrbk.conf diff --git a/install.sh b/install.sh index 4a129df..383ae42 100644 --- a/install.sh +++ b/install.sh @@ -2,7 +2,9 @@ instbtrbk() { install btrbk /usr/local/bin/ +install btrbk.conf /etc/btrbk.conf install -t /etc/systemd/system/ btrbk.service btrbk.timer +systemctl daemon-reload } instrclone() {