fixed loading of configuration files

master
Marc Wäckerlin 7 years ago
parent 96c3420b4f
commit 5ec9d1f164
  1. 19
      btrfs-snapshots.sh

@ -1,12 +1,6 @@
#!/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
# defaults
HOURLY_DEL=25
DAILY_DEL=8
WEEKLY_DEL=5
@ -14,6 +8,15 @@ 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}
# overwrite defaults in configs
if test -e /etc/btrfs-snapshots.conf; then
. /etc/btrfs-snapshots.conf
fi
if test -e ~/.btrfs-snapshots; then
. ~/.btrfs-snapshots
fi
# evaluate commandline
vols=()
del=${DEL}
dryrun=0
@ -144,7 +147,9 @@ for fs in ${BTRFS_VOLUMES}; do
fi
sudo umount "$TMP_MNT"
if test $fast -eq 0; then
echo "Defragment subvolume: '${fs}'"
sudo btrfs filesystem defragment ${fs}
echo "Rebalance subvolume: '${fs}'"
sudo btrfs balance start ${fs}
fi
else

Loading…
Cancel
Save