Added code to fallback to lists of snapshots to find common point
[zfs-ubuntu/.git] / zfs-autosnap
index cfe80aaab8adb067e0cfa1615186f716ce96f548..da9090635011700f3b876e2c06e03befe417540b 100755 (executable)
@@ -50,7 +50,7 @@ filesystem=$1
 mountpoint=${2-/$1}
 numsnapshots=${3-12}
 maxagedays=${4-0}
-lockdir="/tmp/${filesystem}.lock"
+lockdir="/tmp/zfs-admin-lock"
 pool=`echo "$filesystem" | awk -F '/' '{ print $1 }'`
 
 if [ -z "$filesystem" ] || [ -z "$mountpoint" ] || [ -z "$numsnapshots" ] || [ -z "$maxagedays" ]; then
@@ -111,8 +111,8 @@ snapshot "${filesystem}@${datetime}"
 
 minutes=$(echo $datetime | datetime_to_minutes)
 
-lockdir="/tmp/zfs-admin-lock"
 if ! mkdir "$lockdir" >/dev/null 2>&1; then
+  echo "-W- The zfs filesystem has been locked down. Skipping snapshot cleanup."
   exit 0
 fi
 cleanup() { rm -rf "$lockdir"; }