diff options
Diffstat (limited to 'bundles/lhost/files/lhost-prune')
| -rwxr-xr-x | bundles/lhost/files/lhost-prune | 20 |
1 files changed, 20 insertions, 0 deletions
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 |