From 3d2cf298bf71c95e23edee19349e9ab4b9e7d6d5 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 14 Mar 2017 14:58:51 -0500 Subject: [PATCH] Fix broken conditional check that identifies whether content is cached in order to clean it. --- .sandstorm/launcher.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.sandstorm/launcher.sh b/.sandstorm/launcher.sh index 1dfe6d7..2347b96 100644 --- a/.sandstorm/launcher.sh +++ b/.sandstorm/launcher.sh @@ -53,20 +53,19 @@ function cleanup() { local data_path="$1" # full path to data directory of wiki local retention_days="$2" # number of days after which old files are to be removed - + # purge files older than ${retention_days} days from attic and media_attic (old revisions) find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete - + # remove stale lock files (files which are 1-2 days old) find "${data_path}"/locks/ -name '*.lock' -type f -mtime +1 -delete - + # remove empty directories find "${data_path}"/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}/ \ -mindepth 1 -type d -empty -delete - + # remove files older than ${retention_days} days from the cache - if [ -e "${data_path}"/cache/?/ ] - then + if [ ! -z "$(ls -A $data_path/cache)" ]; then find "${data_path}"/cache/?/ -type f -mtime +${retention_days} -delete fi }