You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2018/04/12 09:22:24 UTC

svn commit: r1828961 - /httpd/mod_mbox/trunk/scripts/update-index-monthly

Author: rjung
Date: Thu Apr 12 09:22:23 2018
New Revision: 1828961

URL: http://svn.apache.org/viewvc?rev=1828961&view=rev
Log:
scripts/update-index-monthly: Fix year end processing.
PR 61957. Patch provided by sebb.

Modified:
    httpd/mod_mbox/trunk/scripts/update-index-monthly

Modified: httpd/mod_mbox/trunk/scripts/update-index-monthly
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/scripts/update-index-monthly?rev=1828961&r1=1828960&r2=1828961&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/scripts/update-index-monthly (original)
+++ httpd/mod_mbox/trunk/scripts/update-index-monthly Thu Apr 12 09:22:23 2018
@@ -2,9 +2,15 @@
 # ZSH 4+ script to ensure that we are up-to-date last month
 DATE=`date -u "+%Y%m"`
 typeset -i DATE
-# add year support sometime...
 CURDATE=$DATE
-DATE=$DATE-1
+# date is of the form YYYYMM
+# if the date ends in 01, we need to subtract 1 year and add 11 months
+if [[ $(($DATE % 100)) == 1 ]]
+then
+    DATE=$DATE-89 # i.e. -100 (1 year) +11 (months)
+else
+    DATE=$DATE-1
+fi
 ARCHIVES_PATH=$HOME/archives/mbox-archives.conf
 
 if [ $# -ge 1 ]; then