From: Joerg Jaspert Date: Fri, 25 Apr 2008 19:06:38 +0000 (+0200) Subject: Make split-done only run on files older than 30 days and run it via cron.weekly X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a04fb340f90ae58276f1c12f9839255d899b30c2;p=dak Make split-done only run on files older than 30 days and run it via cron.weekly --- diff --git a/ChangeLog b/ChangeLog index ce36677e..7666bdba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-04-25 Joerg Jaspert + + * dak/split_done.py (main): Only move files into their subdirs if + they are older than 30 days. That enables us to run this script as + part of a cronjob. + + * config/debian/cron.weekly: Run dak split-done + 2008-04-23 Thomas Viehmann * dak/process_unchecked.py: add changes["sponsoremail"] diff --git a/config/debian/cron.weekly b/config/debian/cron.weekly index 53c866f2..1124afa8 100755 --- a/config/debian/cron.weekly +++ b/config/debian/cron.weekly @@ -17,8 +17,12 @@ fi # Clean up apt-ftparchive's databases +# Split queue/done +dak split-done + cd $configdir apt-ftparchive -q clean apt.conf apt-ftparchive -q clean apt.conf.buildd + ################################################################################ diff --git a/dak/split_done.py b/dak/split_done.py index 3c50bd1b..2fd6f222 100755 --- a/dak/split_done.py +++ b/dak/split_done.py @@ -26,11 +26,15 @@ import daklib.utils def main(): Cnf = daklib.utils.get_conf() count = 0 + move_date = int(time.time())-(30*84600) os.chdir(Cnf["Dir::Queue::Done"]) files = glob.glob("%s/*" % (Cnf["Dir::Queue::Done"])) for filename in files: if os.path.isfile(filename): - mtime = time.gmtime(os.stat(filename)[stat.ST_MTIME]) + filemtime = os.stat(filename)[stat.ST_MTIME] + if filemtime < move_date: + continue + mtime = time.gmtime(filemtime) dirname = time.strftime("%Y/%m/%d", mtime) if not os.path.exists(dirname): print "Creating: %s" % (dirname)