]> TLD Linux GIT Repositories - packages/squid.git/commitdiff
- missed in previous commit
authorMarcin Krol <hawk@tld-linux.org>
Mon, 22 Oct 2018 15:53:09 +0000 (15:53 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Mon, 22 Oct 2018 15:53:09 +0000 (15:53 +0000)
squid-check_cache [new file with mode: 0644]

diff --git a/squid-check_cache b/squid-check_cache
new file mode 100644 (file)
index 0000000..fdcb41d
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# determine which one is the cache_swap directory
+CACHE_SWAP=$(awk '/^cache_dir/{print $3}' /etc/squid/squid.conf)
+[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/cache/squid
+
+need_init=0
+for dir in $CACHE_SWAP; do
+       if [ ! -d $dir/00 ]; then
+               need_init=1
+       fi
+done
+if [ $need_init = 1 ]; then
+       squid -z -F -D >> /var/log/squid/squid.out 2>&1
+fi
+exit 0