* report a failed update once a day
authorDon Armstrong <don@debian.org>
Mon, 2 Mar 2009 01:53:48 +0000 (01:53 +0000)
committerDon Armstrong <don@debian.org>
Mon, 2 Mar 2009 01:53:48 +0000 (01:53 +0000)
git-svn-id: svn+ssh://svn.debian.org/svn/pkg-listmaster/trunk/spamassassin_config@293 0b7a5b0c-1f2c-0410-bd74-c376f8064c91

update_spamassassin

index 1769913..3ffa065 100755 (executable)
@@ -48,17 +48,18 @@ trap remove_pidfile ERR;
 FAILUREMESSAGE="";
 function report_failure(){
     # Hrm; a previous update failed; don't report again until the file
-    # is removed
-    if [ -e "$SACONFIG/failed_update" ]; then
+    # is removed or it's more than a day old
+    if [ -e "$SACONFIG/failed_update" ] &&
+       [ $(($(date +%s) - $(stat -c '%Y' "$SACONFIG/failed_update"))) -lt 86400 ];  then
        rm -rf "$TMPDIR"
        exit 0;
     fi;
-    echo "$FAILUREMESSAGE" >> "$SACONFIG/failed_update"
+    echo "$FAILUREMESSAGE" > "$SACONFIG/failed_update"
     echo "$FAILUREMESSAGE";
     cat - <<EOF;
 
-Update_spamassassin will not report any additional errors until this
-is fixed.
+update_spamassassin will only report this error once a day, and
+updates will not occur until this is fixed.
 
 Please fix the problem and then remove
 $SACONFIG/failed_update