home · contact · privacy
Handle mailbox files instead of maildirs too.
[pingmail.git] / pingmail
index b59fa4906adb4b0ec3fc94cf3f03ade8463be2d5..f40eb0fba5c711bf0649ac6ce4eeaf579e8afe48 100755 (executable)
--- 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 <<EOF
+if [ ! "$mbox" = "" ]; then
+       modtime_mails=`stat "$mbox" --format=%Y`
+else
+       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 <<EOF
 $(grep -lER "$matchstring" $maildir)
 EOF
+fi
 
 # find delta of last life sign datetime / test file modtime and current datetime
 now=`date +%s`