updated names

This commit is contained in:
snaki 2022-05-31 13:47:52 +02:00
parent fe627df7d8
commit e874996577
3 changed files with 7 additions and 5 deletions

10
btrbk
View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source config.sh source /etc/btrbk.conf
startDate=$(date +%s) startDate=$(date +%s)
function bkRun { function bkRun {
@ -19,11 +19,11 @@ function bkRun {
btrfs subvolume snapshot -r ${SUBVOLS[$i]} $SNAPDIR$snapName btrfs subvolume snapshot -r ${SUBVOLS[$i]} $SNAPDIR$snapName
sync sync
fi 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 btrfs send -p $snapLast $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month"-incr/"$snapName.pgp
else else
btrfs send $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month"-full/"$snapName.pgp 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/ rclone delete $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr/
if rclone ls $RCLONEDIR$(date -d "$date -2 month" +%Y-%B)-full/; then if rclone ls $RCLONEDIR$(date -d "$date -2 month" +%Y-%B)-full/; then
rclone delete $RCLONEDIR$(date -d "$date -2 month" +%Y-%B)-full/ rclone delete $RCLONEDIR$(date -d "$date -2 month" +%Y-%B)-full/
@ -40,9 +40,9 @@ function bkRun {
function testDate { function testDate {
if [ `date +%d` != "01" ]; then if [ `date +%d` != "01" ]; then
bkRun "daily" bkRun "incremental"
else else
bkRun "monthly" bkRun "full"
fi fi
} }

View file

@ -2,7 +2,9 @@
instbtrbk() { instbtrbk() {
install btrbk /usr/local/bin/ install btrbk /usr/local/bin/
install btrbk.conf /etc/btrbk.conf
install -t /etc/systemd/system/ btrbk.service btrbk.timer install -t /etc/systemd/system/ btrbk.service btrbk.timer
systemctl daemon-reload
} }
instrclone() { instrclone() {