3 # libapache-gallery-perl cleanup
4 # Remove all files in $cachedir that have not been accessed in a week,
5 # then remove empty directories. Run as user $user.
9 cachedir="/var/cache/www"
12 if [ -d "$cachedir" ]; then
14 start-stop-daemon --start --pidfile /dev/null --startas /bin/sh \
15 --oknodo --chuid "$user" -- -c \
16 "find '$cachedir' -type f -atime +6 -delete"
17 # remove empty directories
18 start-stop-daemon --start --pidfile /dev/null --startas /bin/sh \
19 --oknodo --chuid "$user" -- -c \
20 "find '$cachedir' -mindepth 1 -depth -type d -print0 | \
21 xargs -r0 rmdir --ignore-fail-on-non-empty"