blob: bf1a56a6603f7e71c8a8179d5edad5f9cbe6ac19 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/sh
set -eu
[ -n "${DEBUG:-}" ] && set -x
main() {
local dryrun=$([ -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 \
\) \
-print |
grep -v "$(cat "${root}/.keep")" |
xargs -I% ${dryrun} rm -rv '%'
}
main
|