--- /dev/null
+#!/bin/bash
+# Checks to make sure the $lockdir hasn't been held for too long
+
+MAXAGE_MIN=1440
+
+# source our configuration
+config="/etc/bin/zfs-scripts.conf"
+[ -e "${config}.dist" ] && . ${config}.dist
+[ -e "${config}" ] && . ${config}
+
+if test "`find $lockdir -mmin +$MAXAGE_MIN 2>/dev/null`"; then
+ #echo "-> Found $lockdir that is > 1 day old"
+ ls -ld $lockdir | $mailx -s "zfs admin lock file > 1 day old" "$mailto"
+ exit 1
+fi
+
+PROC_ID=$(ps -e -o pid,etimes,command | grep zfs-replicate-all | grep -v tail | awk '{if($2>86400) print $0}' | head -n 1 | awk '{print $1}')
+if [[ -n "$PROC_ID" ]]; then
+ ps -ef | grep $PROC_ID | grep -v grep | $mailx -s "zfs-replicate-all running > 1 day" "$mailto"
+ exit 1
+fi
+
+exit 0