Remove old planet-notes-dump files
authorGrant Slater <git@firefishy.com>
Sun, 17 Aug 2014 09:55:35 +0000 (10:55 +0100)
committerGrant Slater <git@firefishy.com>
Sun, 17 Aug 2014 09:56:26 +0000 (10:56 +0100)
cookbooks/planet/templates/default/planet-notes-dump.cron.erb

index 0db3486..f4fa2e7 100644 (file)
@@ -1,2 +1,5 @@
 MAILTO=grant-smaug@firefishy.com
 0 3 * * * www-data /usr/local/bin/planet-notes-dump
+
+#Delete Planet Notes dump files older than 8 days
+0 8 * * * www-data find /store/planet/notes/20??/ -maxdepth 1 -type f -iname 'planet-notes-??????.osn*' -printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | tail -n +17 | xargs -r rm -f