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 mailbox or maildir for last life sign datetime
33 if [ ! "$mbox" = "" ]; then
34 modtime_mails=`stat "$mbox" --format=%Y`
40 modtime=`stat $file --format=%Y`
41 if [ "$modtime" -gt "$modtime_mails" ]; then
42 modtime_mails=$modtime
45 $(grep -lER "$matchstring" $maildir)
49 # find delta of last life sign datetime / test file modtime and current datetime
52 if [ "$modtime_mails" -gt "$modtime_pingfile" ]; then
53 echo "The most recent life sign is in the mails."
54 modtime=$modtime_mails
56 echo "Ping wait file was updated more recently than last life sign from the mails."
57 modtime=$modtime_pingfile
59 delta=`expr $now - $modtime`
60 echo "Wait time since last life sign or ping sent: "$delta" seconds."
62 # if delta > wait time, send reminder to person to check with, start reminder
63 # mail timer if not in existence, re-touch ping wait file
64 if [ "$delta" -gt "$wait_time" ]; then
65 echo $msg2checked | $mailclient_s "$subj2checked" $checked_address
66 echo "Sending ping message."
68 if [ ! -f "$reminder_touch" ]; then
70 echo "Creating reminder message wait time file."
74 # if last life sign datetime / test file modtime > modtime of reminder touch
75 # file, delete it; otherwise, if delta between those > wait time, send reminder
76 # to person checking and then delete reminder touch file
77 if [ -f "$reminder_touch" ]; then
78 modtime_reminder=`stat $reminder_touch --format=%Y`
79 if [ "$modtime" -gt "$modtime_reminder" ]; then
81 echo "Deleting reminder message wait time file."
83 delta=`expr $now - $modtime_reminder`
84 if [ "$delta" -gt "$wait_time" ]; then
85 echo $msg2checker | $mailclient_s "$subj2checker" $checker_address
86 echo "Sending reminder message."
88 echo "Deleting reminder message wait time file."