From d00e0e6d26acbd4c0c5e7b51f6b2900513282456 Mon Sep 17 00:00:00 2001 From: Marcos Mello Date: Wed, 24 Feb 2016 11:27:43 +1300 Subject: [PATCH] Bug 3826: SMP compatibility with systemd ** These changes require capabilities changes specific to Squid-4 and require systemd 209+ NOTE: 'squid -z' command does not yet support SMP with systemd. Differences from the Squid-3 tools/systemd/squid.service: - After=nss-lookup.target, for people running a local DNS server like BIND. Since there is no requirement dependency, it is a NOP when no such service is running. - Type=forking and squid without -N in ExecStart: SMP now works. - PIDFile=/var/run/squid.pid to tell systemd what pid is the main one. This is actually optional with Squid 4, because systemd will consider its first child as the main pid. But let's be safe. DEFAULT_PID_FILE could be used here with proper autoconf/automake magic... - ExecReload calls kill rather than 'squid -k reconfigure'. systemd already knows the main pid. - KillMode=mixed. The old KillMode=process sends SIGTERM (and SIGKILL after TimeoutStopSec) only to main daemon process. 'mixed' OTOH sends SIGTERM only to main process, but SIGKILL to all services' cgroup processes after timeout. With 'mixed' systemd ensures if daemon shutdown fails it will clean up all the remains. 'mixed' requires systemd >= 209. --- tools/systemd/squid.service | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/systemd/squid.service b/tools/systemd/squid.service index 6a84ea4e6e..90dbbae8ce 100644 --- a/tools/systemd/squid.service +++ b/tools/systemd/squid.service @@ -8,13 +8,14 @@ [Unit] Description=Squid Web Proxy Server Documentation=man:squid(8) -After=network.target +After=network.target nss-lookup.target [Service] -Type=simple -ExecStart=/usr/sbin/squid -sYC -N +Type=forking +PIDFile=/var/run/squid.pid +ExecStart=/usr/sbin/squid -sYC ExecReload=/bin/kill -HUP $MAINPID -KillMode=process +KillMode=mixed [Install] WantedBy=multi-user.target -- 2.47.2