+mountpoint=$2
+numsnapshots=${3-12}
+maxagedays=${4-0}
+lockdir="/tmp/${filesystem}.lock"
+pool=`echo "$filesystem" | awk -F '/' '{ print $1 }'`
+
+if [ -z "$filesystem" ] || [ -z "$mountpoint" ] || [ -z "$numsnapshots" ] || [ -z "$maxagedays" ]; then
+ echo "-E- Usage: $0 <filesystem> <mountpoint> <numsnapshots> <maxagedays>"
+ exit 1
+fi
+
+if [ ! -d "$mountpoint" ]; then
+ echo "-E- Unable to find the mountpoint: $mountpoint"
+ exit 1
+fi
+
+snapshotdir="${mountpoint}/.zfs/snapshot"
+if [ ! -d "$snapshotdir" ]; then
+ echo "-E- Unable to find the snapshotdir: $snapshotdir"
+ exit 1
+fi