From 38be6c13f76e893cf47636257071b440dec0c5b2 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 7 Sep 2025 17:32:13 +0200 Subject: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- bundles/lhost/files/lhost-prune | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 bundles/lhost/files/lhost-prune (limited to 'bundles/lhost/files/lhost-prune') diff --git a/bundles/lhost/files/lhost-prune b/bundles/lhost/files/lhost-prune new file mode 100755 index 0000000..8788941 --- /dev/null +++ b/bundles/lhost/files/lhost-prune @@ -0,0 +1,20 @@ +#!/bin/sh +set -eu + +main() { + local dryrun=$(test -n "${DRYRUN:-}" && printf echo) + local root=${ROOT:-/var/www/lhost} + local maxage=${MAXAGE:-30} + + find ${root} \ + -type f \ + -mtime ${maxage} \ + -not \( \ + -name 'Caddyfile' -or \ + -name '.keep' -or \ + -name "$(cat ${root}/.keep)" \ + \) \ + -exec ${dryrun} rm -rv {} + +} + +main >/dev/null 2>&1 -- cgit 1.4.1