chiark / gitweb /
remove stale caches; do not fail if we need to remake only cache symlink
[rrd-graphs.git] / 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 "$@"