Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 454878 - net-proxy/squid - systemd service file
Summary: net-proxy/squid - systemd service file
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mikle Kolyada
Keywords: PATCH
: 504146 528342 (view as bug list)
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
Reported: 2013-01-31 17:46 UTC by Emery Hemingway
Modified: 2019-06-27 08:46 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---

squid systemd service unit (squid.service,340 bytes, text/plain)
2013-01-31 17:46 UTC, Emery Hemingway
squid.service (squid.service,381 bytes, text/plain)
2013-02-01 19:18 UTC, Emery Hemingway
squid unit file (squid.service,260 bytes, text/plain)
2014-10-20 17:19 UTC, Canek Peláez Valdés
correct systemd squid.service (squid.service,979 bytes, text/plain)
2017-02-25 16:00 UTC, Evert

Note You need to log in before you can comment on or make changes to this bug.
Description Emery Hemingway 2013-01-31 17:46:15 UTC
Created attachment 337476 [details]
squid systemd service unit

Attached is a systemd service file for starting Squid.
It parses the Squid config and creates the cache directories at startup, and supports config reloading.
It retains the the max file descriptor limit of 1024 from the OpenRC runscript.

To include in an ebuild, inherit the systemd eclass, and add 'systemd_dounit "${FILESDIR}"/squid.service' to src_install() (assuming squid.service is in $FILESDIR).
Comment 1 Emery Hemingway 2013-02-01 19:18:48 UTC
Created attachment 337624 [details]

Sets user and group to squid.
Comment 2 Eray Aslan gentoo-dev 2013-02-01 22:55:30 UTC
Please contact upstream to provide a systemd unit file.  Thank you.
Comment 3 Jeroen Roovers gentoo-dev 2014-03-11 16:14:08 UTC
*** Bug 504146 has been marked as a duplicate of this bug. ***
Comment 4 Canek Peláez Valdés 2014-10-20 00:31:45 UTC
Pardon me, wasn't the council-approved policy that if a package doesn't provides an upstream-provided unit file, but there is a candidate for one, it should be included in the ebuild?

I have a candidate unit file (based on Arch's), but I see that the one from Emery was rejected, so I'm asking first before uploading it. Also, I can add systemd@g.o to the CC list, since they have offered to take care of the unit file in any ebuild where a maintainer does not want to. Again, I'm just asking before doing that, since I believe adding the unit file is just a matter of adding "systemd" to the inherit line of the ebuild, and doing

systemd_dounit "${FILESDIR}/squid.service"

in the src_install() stage.
Comment 5 Eray Aslan gentoo-dev 2014-10-20 07:00:06 UTC
That comment was probably made before all those systemd discussions and council decision.  Just go adead and attach the unit file.  systemd folk usually take care of the rest.  Adding systemd to cc and reopening.
Comment 6 Canek Peláez Valdés 2014-10-20 17:19:32 UTC
Created attachment 387076 [details]
squid unit file

squid unit file based on Arch's
Comment 7 Amos Jeffries 2014-11-03 13:37:23 UTC
systemd compatibility is being tracked upstream by
Comment 8 Jeroen Roovers gentoo-dev 2014-11-06 01:11:36 UTC
*** Bug 528342 has been marked as a duplicate of this bug. ***
Comment 9 Evert 2017-02-25 16:00:05 UTC
Created attachment 465120 [details]
correct systemd squid.service

Even Red Hat does it wrong.

ExecStop=/usr/sbin/squid -k shutdown -f ${SQUID_CONF} is really the wrong way to go because it doesn't wait for squid to exit, causing systemd to SIGKILL squid right away which is certainly NOT what we want.
Instead, enjoy the SIGTERM default which is identical to "squid -k shutdown" but without the nasty side effect of a (too early) SIGKILL.

However per default, squid takes 30 seconds to exit which is acceptable but quite a long time. Fortunately, this can easily be changed to 1 second in /etc/squid/squid.conf: shutdown_lifetime 1 second

So ... please use this systemd unit in combination with shutdown_lifetime 1 in /etc/squid/squid.conf
Comment 10 Evert 2017-02-25 16:15:27 UTC
Correction, that should be: So ... please use this systemd unit in combination with:

shutdown_lifetime 1 second

in /etc/squid/squid.conf

See also