6 pingmailrc=$HOME'/.pingmailrc'
7 if [ ! -f $pingmailrc ]; then
8 echo 'No .pingmailrc found at '$pingmailrc', aborting.'
15 if [ "$1" = "check" ]; then
17 elif [ "$1" = "touch" ]; then
21 echo 'usage: '$0' COMMAND\n(COMMAND one of "check", "touch")'
25 # check test file for last modtime
27 if [ -f $ping_touch ]; then
28 modtime_pingfile=`stat $ping_touch --format=%Y`
31 # search maildir for last life sign datetime
37 modtime=`stat $file --format=%Y`
38 if [ "$modtime" -gt "$modtime_mails" ]; then
39 modtime_mails=$modtime
42 $(grep -lER "$matchstring" $maildir)
45 # find delta of last life sign datetime / test file modtime and current datetime
48 if [ "$modtime_mails" -gt "$modtime_pingfile" ]; then
49 echo "The most recent life sign is in the mails."
50 modtime=$modtime_mails
52 echo "Ping wait file was updated more recently than last life sign from the mails."
53 modtime=$modtime_pingfile
55 delta=`expr $now - $modtime`
56 echo "Wait time since last life sign or ping sent: "$delta" seconds."
58 # if delta > wait time, send reminder to person to check with, start reminder
59 # mail timer if not in existence, re-touch ping wait file
60 if [ "$delta" -gt "$wait_time" ]; then
61 echo $msg2checked | mutt -s "$subj2checked" $checked_address
62 echo "Sending ping message."
64 if [ ! -f "$reminder_touch" ]; then
66 echo "Creating reminder message wait time file."
70 # if last life sign datetime / test file modtime > modtime of reminder touch
71 # file, delete it; otherwise, if delta between those > wait time, send reminder
72 # to person checking and then delete reminder touch file
73 if [ -f "$reminder_touch" ]; then
74 modtime_reminder=`stat $reminder_touch --format=%Y`
75 if [ "$modtime" -gt "$modtime_reminder" ]; then
77 echo "Deleting reminder message wait time file."
79 delta=`expr $now - $modtime_reminder`
80 if [ "$delta" -gt "$wait_time" ]; then
81 echo $msg2checker | mutt -s "$subj2checker" $checker_address
82 echo "Sending reminder message."
84 echo "Deleting reminder message wait time file."