]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3826: SMP compatibility with systemd
authorMarcos Mello <marcosfrm@gmail.com>
Tue, 23 Feb 2016 22:27:43 +0000 (11:27 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 23 Feb 2016 22:27:43 +0000 (11:27 +1300)
** 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

index 6a84ea4e6e2498b2b3bb5713a6b658dd69fad469..90dbbae8ce2d5ec2e55d4513ddefd49d93940bfd 100644 (file)
@@ -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