From ef9a6966a3405973e51f163a39070f9e30bdcb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marc=20W=C3=A4ckerlin?= Date: Tue, 24 Oct 2017 09:19:25 +0200 Subject: [PATCH] reduced backups through config file by default --- btrfs-snapshots.sh | 21 ++++++++++++++++----- install.sh | 8 ++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/btrfs-snapshots.sh b/btrfs-snapshots.sh index 92bd672..14ffb5d 100755 --- a/btrfs-snapshots.sh +++ b/btrfs-snapshots.sh @@ -1,10 +1,21 @@ #!/bin/bash -e +if test -e /etc/btrfs-snapshot.conf; then + . /etc/btrfs-snapshot.conf +fi +if test -e ~/.btrfs-snapshot; then + . ~/.btrfs-snapshot +fi + +HOURLY_DEL=25 +DAILY_DEL=8 +WEEKLY_DEL=5 +MONTHLY_DEL= BTRFS_VOLUMES=${BTRFS_VOLUMES:-$(awk '!/^#/ && $3=="btrfs" {print $2}' /etc/fstab | tr '\n' ' ' | sed 's, $,,')} TMP_MNT=${TMP_MNT:-/var/tmp/btrfs-backup} vols=() -del= +del=${DEL} dryrun=0 periodity=${0%/*} periodity=${periodity##*/} @@ -14,10 +25,10 @@ else periodity= fi case "$periodity" in - (.hourly) del=25;; - (.daily) del=8;; - (.weekly) del=5;; - (.monthly);; + (.hourly) del=${HOURLY_DEL};; + (.daily) del=${DAILY_DEL};; + (.weekly) del=${WEEKLY_DEL};; + (.monthly) del=${MONTHLY_DEL};; esac while test $# -gt 0; do case "$1" in diff --git a/install.sh b/install.sh index 51fb569..62f9998 100755 --- a/install.sh +++ b/install.sh @@ -3,3 +3,11 @@ for f in hourly daily weekly monthly; do sudo cp btrfs-snapshots.sh /etc/cron.$f/btrfs-snapshots; done +if ! test -e /etc/btrfs-snapshots.conf; then + cat > /etc/btrfs-snapshots.conf <