[packages/squid] - added systemd service unit and script to check cache swap based on init script

kiesiu kiesiu at pld-linux.org
Fri Sep 12 12:28:28 CEST 2014


commit 9aee221f84037b35dfa4693886cfecd2fc3a4f3a
Author: Łukasz Kieś <kiesiu at pld-linux.org>
Date:   Fri Sep 12 11:59:42 2014 +0200

    - added systemd service unit and script to check cache swap based on init script

 squid-check_cache | 16 ++++++++++++++++
 squid.service     | 18 ++++++++++++++++++
 2 files changed, 34 insertions(+)
---
diff --git a/squid-check_cache b/squid-check_cache
new file mode 100644
index 0000000..fdcb41d
--- /dev/null
+++ b/squid-check_cache
@@ -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
index 0000000..bcf76c0
--- /dev/null
+++ b/squid.service
@@ -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
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/squid.git/commitdiff/03049ebb120d488aa80b2634d55e9d4789382720



More information about the pld-cvs-commit mailing list