From 352a10bf383c38c0b45bf0b66fec0bfd874ba08d Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Fri, 15 Apr 2016 00:07:10 +0200 Subject: add a cleanup cronjob which deletes old polls --- dudle_cleanup.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 dudle_cleanup.sh (limited to 'dudle_cleanup.sh') diff --git a/dudle_cleanup.sh b/dudle_cleanup.sh new file mode 100644 index 0000000..80620cb --- /dev/null +++ b/dudle_cleanup.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +DAYS=90 + +# installation path +DUDLE_DIR=/var/www/dudle/ + +for i in `find $DUDLE_DIR -maxdepth 2 -name last_read_access -mtime +$DAYS`;do + echo "[`date --rfc-3339=seconds`] `ls -l $i`" + rm -rf "`dirname "$i"`" +done + +# clean up manually deleted polls +for i in `find /tmp/ -maxdepth 2 -name last_read_access -mtime +$DAYS`;do + echo "[`date --rfc-3339=seconds`] `ls -l $i`" + rm -rf "`dirname "$i"`" +done -- cgit v1.2.3