From 0d47b0fd505d104ea34cb3f12206a468e812508d Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 5 May 2019 20:01:50 +0200 Subject: [PATCH] logsclaner init.d script: only remove files older than 7 days --- Full/system/etc/init.d/logscleaner | 40 +++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/Full/system/etc/init.d/logscleaner b/Full/system/etc/init.d/logscleaner index a4c9c78..3979dab 100755 --- a/Full/system/etc/init.d/logscleaner +++ b/Full/system/etc/init.d/logscleaner @@ -2,19 +2,29 @@ echo "logscleaner init script" echo "Starting Automatic Cleaning $(date +"%m-%d-%Y %H:%M:%S")" -rm -f /data/data/*/*/*/*.tmp -rm -f /data/data/*/*/*/*/*.tmp -rm -f /data/local/*.apk -rm -f /data/local/tmp/*.apk -rm -f /data/log/* -rm -f /data/slog/* -rm -f /cache/*.* -rm -f /cache/recovery/*.* -rm -f /data/system/dropbox/*.* -rm -f /data/backup/pending/*.tmp -rm -f /data/tombstones/* -rm -f /data/system/usagestats/0/daily/* -rm -f /data/system/usagestats/0/monthly/* -rm -f /data/system/usagestats/0/weekly/* -rm -f /data/system/usagestats/0/yearly/* + +# remove files older than a week to prevent pollution + +# filemask: * +for logpath in /data/log /data/slog /data/tombstones \ + /data/system/usagestats/0; do + find ${logpath} -mtime +8 -type f -exec rm -f {} \; +done + +# filemask: *.tmp +for logpath in /data/data/*/*/* /data/data/*/*/*/* \ + /data/backup/pending/; do + find ${logpath} -mtime +8 -type f -name '*.tmp' -exec rm -f {} \; +done + +# filemask: *.apk +for logpath in /data/local/ /data/local/tmp; do + find ${logpath} -mtime +8 -type f -name '*.apk' -exec rm -f {} \; +done + +# filemask: *.* +for logpath in /cache /cache/recovery /data/system/dropbox; do + find ${logpath} -mtime +8 -type f -name '*.apk' -exec rm -f {} \; +done + echo "Automatic Cleaning finished at $(date +"%m-%d-%Y %H:%M:%S")"