You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2006/02/27 01:27:04 UTC
svn commit: r381206 - /spamassassin/trunk/build/mkupdates/tick_zone_serial
Author: felicity
Date: Sun Feb 26 16:27:01 2006
New Revision: 381206
URL: http://svn.apache.org/viewcvs?rev=381206&view=rev
Log:
make sure the counter file is reset to 0 when it's a new day, otherwise we'll get into strange situations where we can't make new updates for a day.
Modified:
spamassassin/trunk/build/mkupdates/tick_zone_serial
Modified: spamassassin/trunk/build/mkupdates/tick_zone_serial
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/build/mkupdates/tick_zone_serial?rev=381206&r1=381205&r2=381206&view=diff
==============================================================================
--- spamassassin/trunk/build/mkupdates/tick_zone_serial (original)
+++ spamassassin/trunk/build/mkupdates/tick_zone_serial Sun Feb 26 16:27:01 2006
@@ -30,6 +30,14 @@
# and a datestamp too.
oldcount=`cat $soadir/counter`
+
+# avoid issues where oldcount=99 and then we can't do any other updates that
+# day. if the old counter was last updated before midnight, reset counter to
+# 0.
+if perl -e 'use Time::Local; @t=localtime; $mn=timelocal 0,0,0,@t[3..6]; ($mtime) = (stat("'"$soadir"'/counter"))[9]; exit($mn<=$mtime);'; then
+ oldcount=-1
+fi
+
newserial=`perl -e '
my $count = (($ARGV[0] + 1) % 100);
@@ -39,7 +47,7 @@
open (INCR, ">'"$soadir"'/counter") or die "open failed $soadir";
print INCR $count,"\n"; close INCR or die "close failed $soadir";
-' $oldcount`
+' -- $oldcount`
soafile=$soadir/soa_line
rm -f $soafile.bak \