]> git.pld-linux.org Git - packages/squid.git/commitdiff
- added systemd service unit and script to check cache swap based on init script
authorŁukasz Kieś <kiesiu@pld-linux.org>
Fri, 12 Sep 2014 09:59:42 +0000 (11:59 +0200)
committerŁukasz Kieś <kiesiu@pld-linux.org>
Fri, 12 Sep 2014 09:59:42 +0000 (11:59 +0200)
squid-check_cache [new file with mode: 0644]
squid.service [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
diff --git a/squid.service b/squid.service
new file mode 100644 (file)
index 0000000..bcf76c0
--- /dev/null
@@ -0,0 +1,18 @@
+[Unit]
+Description=Squid caching proxy
+After=syslog.target network.target
+
+[Service]
+Type=forking
+User=squid
+Group=squid
+EnvironmentFile=-/etc/sysconfig/squid
+LimitNOFILE=8192
+ExecStartPre=@@LIBEXECDIR@@/squid-check_cache
+ExecStart=/usr/sbin/squid $SQUID_OPTS
+ExecReload=/usr/sbin/squid $SQUID_OPTS -k reconfigure
+ExecStop=/usr/sbin/squid -k shutdown
+TimeoutStopSec=60
+
+[Install]
+WantedBy=multi-user.target
This page took 0.094437 seconds and 4 git commands to generate.