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
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mikle Kolyada (RETIRED)
URL:
Whiteboard:
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: 2021-03-07 10:35 UTC (History)
6 users (show)

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


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

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]
squid.service

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 (RETIRED) 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
http://bugs.squid-cache.org/show_bug.cgi?id=3826
Comment 8 Jeroen Roovers (RETIRED) 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 http://www.christianschenk.org/blog/tuning-and-hardening-squid/
Comment 11 Emil Petrakov 2020-12-02 22:54:28 UTC
Is there any chance to get a service file for systemd?
Comment 12 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2020-12-03 00:08:07 UTC
Upstream now ships a systemd service file at tools/systemd/squid.service in the 4.13 tarball, so this should be trivial to fix.
Comment 13 Emil Petrakov 2020-12-03 11:24:42 UTC
(In reply to John Helmert III (ajak) from comment #12)
> Upstream now ships a systemd service file at tools/systemd/squid.service in
> the 4.13 tarball, so this should be trivial to fix.

I meant "any chance to get a file installed into proper place using emerge".
Comment 14 Larry the Git Cow gentoo-dev 2021-03-07 10:35:58 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b7dc497f33a127dbf5706db72e9c5a077a8b82c

commit 5b7dc497f33a127dbf5706db72e9c5a077a8b82c
Author:     Mikle Kolyada <zlogene@gentoo.org>
AuthorDate: 2021-03-07 10:33:24 +0000
Commit:     Mikle Kolyada <zlogene@gentoo.org>
CommitDate: 2021-03-07 10:35:55 +0000

    net-proxy/squid: add systemd support
    
    Closes: https://bugs.gentoo.org/454878
    Package-Manager: Portage-3.0.13, Repoman-3.0.2
    Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>

 net-proxy/squid/{squid-4.13.ebuild => squid-4.13-r1.ebuild} | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)