]> git.donarmstrong.com Git - deb_pkgs/libapache-gallery-perl.git/blobdiff - debian/cron.daily
[svn-inject] Applying Debian modifications (0.99-svn060811-1) to trunk
[deb_pkgs/libapache-gallery-perl.git] / debian / cron.daily
diff --git a/debian/cron.daily b/debian/cron.daily
new file mode 100644 (file)
index 0000000..f196666
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# libapache-gallery-perl cleanup
+# Remove all files in $cachedir that have not been accessed in a week,
+# then remove empty directories.  Run as user $user.
+
+set -e
+
+cachedir=/var/tmp/Apache-Gallery
+user=www-data
+
+if [ -d $cachedir ]; then
+    # remove old files
+    start-stop-daemon --start --pidfile /dev/null --startas /bin/sh \
+       --oknodo --chuid $user -- -c \
+       "find $cachedir -type f -atime +6 -print0 | xargs -r0 rm -f"
+    # remove empty directories
+    start-stop-daemon --start --pidfile /dev/null --startas /bin/sh \
+       --oknodo --chuid $user -- -c \
+       "find $cachedir -depth -type d -print0 | \
+        xargs -r0 rmdir --ignore-fail-on-non-empty"
+fi
+
+exit 0