chiark / gitweb /
remove stale caches; do not fail if we need to remake only cache symlink
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 7 Jul 2010 13:09:50 +0000 (14:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 7 Jul 2010 13:09:50 +0000 (14:09 +0100)
cgi-invoke

index ea2030735f15a1406a6509b6b5e94e617e71dfde..cd46ce970978a8569630ae3f1d89ad66d513f77b 100755 (executable)
@@ -3,9 +3,12 @@ set -e
 exec with-lock-ex -w data/graph-lock sh -ec '
        if ! test -d cache; then
                quicksand-setup ||:
-               mkdir $GRAPH_CGI_CACHE
+               if ! test -d $GRAPH_CGI_CACHE; then mkdir $GRAPH_CGI_CACHE; fi
                rm -f cache
                ln -s $GRAPH_CGI_CACHE cache
        fi
+        if test cgi -nt cache/.; then
+                rm -f cache/*
+        fi
        ./cgi "$@"
 ' x "$@"