From: Alan J. Pippin Date: Sat, 31 Dec 2022 16:54:51 +0000 (-0700) Subject: Added new zfs lock checking script X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/%7Blink_activity%7D?a=commitdiff_plain;h=0b68c7a7e82f49184bccf7ca83ce3ec08654f0ff;p=zfs-ubuntu%2F.git Added new zfs lock checking script Change-Id: I4b914aca266e90f691fa7eda58b394b6bc925881 --- diff --git a/zfs-check-admin-lock b/zfs-check-admin-lock new file mode 100755 index 0000000..109879d --- /dev/null +++ b/zfs-check-admin-lock @@ -0,0 +1,23 @@ +#!/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