reduced backups through config file by default

master
Marc Wäckerlin 7 years ago
parent 26b3fbf006
commit ef9a6966a3
  1. 21
      btrfs-snapshots.sh
  2. 8
      install.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

@ -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 <<EOF
HOURLY_DEL=4
DAILY_DEL=3
WEEKLY_DEL=2
MONTHLY_DEL=3
EOF
fi

Loading…
Cancel
Save