From 34fb84e4ef7b70986d6714a7899946dcc4902b4c Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Sun, 16 Aug 2020 10:30:44 +0200 Subject: [PATCH] Add cached media cleanup cron job --- CloudronManifest.json | 8 +++++++- Dockerfile | 2 +- cleanup.sh | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 cleanup.sh diff --git a/CloudronManifest.json b/CloudronManifest.json index 38fb4fa..fc4fa1a 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -14,7 +14,13 @@ "postgresql": {}, "redis": {}, "sendmail": {}, - "ldap": {} + "ldap": {}, + "scheduler": { + "cleanup": { + "schedule": "11 11 * * *", + "command": "/app/pkg/cleanup.sh" + } + } }, "minBoxVersion": "4.1.4", "manifestVersion": 2, diff --git a/Dockerfile b/Dockerfile index 1346ed3..641c78b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ RUN ln -fs /run/mastodon/bullet.log /app/code/log/bullet.log RUN ln -fs /app/data/system /app/code/public/system RUN rm -rf /app/code/tmp && ln -fs /tmp/mastodon /app/code/tmp -COPY start.sh env.template /app/pkg/ +COPY start.sh cleanup.sh env.template /app/pkg/ CMD [ "/app/pkg/start.sh" ] diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 0000000..0c6ce4f --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -eu + +echo "=> Cleanup cached media" + +cd /app/code +./bin/tootctl media remove