From 14dfa8853e4014e8d01e6f8ab595bf64a7ec861c Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 3 Dec 2018 18:48:35 +0100 Subject: [PATCH] Handle mailbox files instead of maildirs too. --- README | 9 +++++++++ pingmail | 24 ++++++++++++++---------- pingmailrc.example | 9 ++++++--- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/README b/README index 5908bcd..9ce6207 100644 --- a/README +++ b/README @@ -1,5 +1,14 @@ Small shell script to regularly check a target person's responsiveness via mail. +When run as "pingmail check", tries to derive the last time a person sent a +mail to the local system by either a) searching a maildir for the most recent +file matching a regex pattern (such as a "From: " field matching the target +person), and looking at thta file's modification time, or b) checking the +modification time of a defined mailbox file. If that point in time is too +distant, sends an e-mail to the target person requesting some sign of life. +After some more wait time without a sign of life, sends a warning message to +another mail address that target person is unresponsive. + When run as "pingmail check", searches a maildir for the most recent file matching a regex pattern (such as a "From: " field matching the target person), and if the most recent file is too old, sends an e-mail to the target person diff --git a/pingmail b/pingmail index b59fa49..f40eb0f 100755 --- a/pingmail +++ b/pingmail @@ -28,19 +28,23 @@ if [ -f $ping_touch ]; then modtime_pingfile=`stat $ping_touch --format=%Y` fi -# search maildir for last life sign datetime +# search mailbox or maildir for last life sign datetime modtime_mails=0 -while read file; do - if [ -z $file ]; then - break - fi - modtime=`stat $file --format=%Y` - if [ "$modtime" -gt "$modtime_mails" ]; then - modtime_mails=$modtime - fi -done <