aboutsummaryrefslogtreecommitdiffstats
path: root/service/cleaner.sh
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-05-29 14:24:31 +0200
committerLouis Burda <quent.burda@gmail.com>2021-05-29 14:24:31 +0200
commit13b65f01132c41be9ab8d9f92c2c5ca605c366d8 (patch)
tree74bd5b4dee779e4600d416adf4abcd4f621addab /service/cleaner.sh
parent62d99253144a14648c4da1c2a60c01e7b06ef02c (diff)
downloadenowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.tar.gz
enowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.zip
changed repo structure and commited releease files such that default docker-compose worklow commands work in testvm
Diffstat (limited to 'service/cleaner.sh')
-rw-r--r--service/cleaner.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/service/cleaner.sh b/service/cleaner.sh
new file mode 100644
index 0000000..bd67705
--- /dev/null
+++ b/service/cleaner.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+timeref="/data/lastclean"
+
+if [ -z "$RESULTDIR" ]; then
+ echo "RESULTDIR is undefined! skipping cleanup.."
+ exit 1
+fi
+
+if [ -f "$timeref" ]; then
+ files="$(find "$RESULTDIR" -mindepth 1 \! -newer "$timeref")"
+ echo "$files" | while read path; do
+ rm -rf "$path"
+ done
+ if [ -z "$files" ]; then
+ filecount=0
+ else
+ filecount=$(echo "$files" | wc -l)
+ fi
+ echo "[ $(date +%T) ] Removed $filecount old files!"
+fi
+
+touch "$timeref"
+