From 3cb43a6a1095b4dd4cb8b2a03e3d232159d4242b Mon Sep 17 00:00:00 2001 From: root Date: Mon, 30 Nov 2015 15:03:51 +0100 Subject: [PATCH] use PATH to find btrfs. --- snapshot.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/snapshot.sh b/snapshot.sh index 88aa8d1..b35265d 100755 --- a/snapshot.sh +++ b/snapshot.sh @@ -20,16 +20,17 @@ # 0 * * * * /root/somescripts/btrfs/snapshot.sh &> /dev/null # This script will generate: current_$vol.snp/.txt + last_$vol.snp/.txt and date_$date_$vol.snp/.txt # -# Timestamp of creation. -STARTTS="`date +'%Y-%m-%d--%H-%M'`" -CALLPATH="`pwd`" + MAXSNAPP=25 DELSNAPP=5 +STARTTS="`date +'%Y-%m-%d--%H-%M'`" +CALLPATH="`pwd`" +PATH="${PATH}:/sbin" + echo $STARTTS mount /mnt/btrfs &> /dev/null cd /mnt/btrfs -#exit 0 #for every .autosnap subvol... for vol in $(find /mnt/btrfs -xdev -maxdepth 1 -iname '*.autosnap'); do @@ -38,7 +39,7 @@ for vol in $(find /mnt/btrfs -xdev -maxdepth 1 -iname '*.autosnap'); do # delete snap to allow move. if [ -e "${VOLNAME}.$(echo "$MAXSNAPP+1"|bc).snap" ]; then - /bin/btrfs subvolume delete "${VOLNAME}.$(echo "$MAXSNAPP+1"|bc).snap" + btrfs subvolume delete "${VOLNAME}.$(echo "$MAXSNAPP+1"|bc).snap" fi # move existing snapshots @@ -51,12 +52,12 @@ for vol in $(find /mnt/btrfs -xdev -maxdepth 1 -iname '*.autosnap'); do # create new snapshot touch -m -a "${VOLNAME}.autosnap" - /bin/btrfs subvolume snapshot -r "${VOLNAME}.autosnap" "${VOLNAME}.0.snap" + btrfs subvolume snapshot -r "${VOLNAME}.autosnap" "${VOLNAME}.0.snap" # delete snapshots... (also fixes off by one) for i in $(seq 0 ${DELSNAPP}) ; do if [ -e "${VOLNAME}.$(echo "$MAXSNAPP+$i"|bc).snap" ]; then - /bin/btrfs subvolume delete "${VOLNAME}.$(echo "$MAXSNAPP+$i"|bc).snap" + btrfs subvolume delete "${VOLNAME}.$(echo "$MAXSNAPP+$i"|bc).snap" fi done done -- 2.43.0