From: Marcos Mello Date: Tue, 23 Feb 2016 22:27:43 +0000 (+1300) Subject: Bug 3826: SMP compatibility with systemd X-Git-Tag: SQUID_4_0_8~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d00e0e6d26acbd4c0c5e7b51f6b2900513282456;p=thirdparty%2Fsquid.git 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. --- 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