]> git.donarmstrong.com Git - deb_pkgs/libapache-gallery-perl.git/blob - debian/cron.daily
f19666610e3782abb3be52f28e9fb49d581a3117
[deb_pkgs/libapache-gallery-perl.git] / debian / cron.daily
1 #!/bin/sh
2 #
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.
6
7 set -e
8
9 cachedir=/var/tmp/Apache-Gallery
10 user=www-data
11
12 if [ -d $cachedir ]; then
13     # remove old files
14     start-stop-daemon --start --pidfile /dev/null --startas /bin/sh \
15         --oknodo --chuid $user -- -c \
16         "find $cachedir -type f -atime +6 -print0 | xargs -r0 rm -f"
17     # remove empty directories
18     start-stop-daemon --start --pidfile /dev/null --startas /bin/sh \
19         --oknodo --chuid $user -- -c \
20         "find $cachedir -depth -type d -print0 | \
21          xargs -r0 rmdir --ignore-fail-on-non-empty"
22 fi
23
24 exit 0