summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-proxy/squid/files/squid.cron-r1')
-rw-r--r--net-proxy/squid/files/squid.cron-r115
1 files changed, 15 insertions, 0 deletions
diff --git a/net-proxy/squid/files/squid.cron-r1 b/net-proxy/squid/files/squid.cron-r1
new file mode 100644
index 000000000000..f0fa84ed2cb3
--- /dev/null
+++ b/net-proxy/squid/files/squid.cron-r1
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# OpenRC init script supports multiple Squid instances, and exposes 'rotate'.
+if command -v rc-service >/dev/null; then
+ SQUID_SERVICES=$(rc-status | awk '/ *squid.* started /{print $1}')
+ for SQUID_SERVICE in $SQUID_SERVICES ; do
+ rc-service "${SQUID_SERVICE}" rotate
+ done
+
+# Systemd unit file supports only a single default squid instance,
+# and no 'rotate' support, so call squid directly.
+elif command -v systemctl >/dev/null; then
+ SQUID_ACTIVE=$(systemctl --type=service --state=active | awk '/^ *squid\.service / {print $1}')
+ [ -n "${SQUID_ACTIVE}" ] && squid -k rotate
+fi