Small shell script to regularly check a target person's responsiveness via mail.
-Expects mutt to be usable for sending mails via command line.
-
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
# if delta > wait time, send reminder to person to check with, start reminder
# mail timer if not in existence, re-touch ping wait file
if [ "$delta" -gt "$wait_time" ]; then
- echo $msg2checked | mutt -s "$subj2checked" $checked_address
+ echo $msg2checked | $mailclient_s "$subj2checked" $checked_address
echo "Sending ping message."
touch $ping_touch
if [ ! -f "$reminder_touch" ]; then
else
delta=`expr $now - $modtime_reminder`
if [ "$delta" -gt "$wait_time" ]; then
- echo $msg2checker | mutt -s "$subj2checker" $checker_address
+ echo $msg2checker | $mailclient_s "$subj2checker" $checker_address
echo "Sending reminder message."
rm $reminder_touch
echo "Deleting reminder message wait time file."
\nNo life signs from '$id_target' for the last '$reminder_time' seconds.
\nMaybe you should give them a call to check if they are okay.'
+# mail client command reading message body from stdin and subject from parameter
+mailclient_s='mutt -s'
+
# pattern to search $maildir for recursively for lifesigns
checked_address_escaped=`echo $checked_address | sed 's/\./\\./g'`
matchstring='^From: .*('$checked_address_escaped'|alternate@example\.org)'