Bug 2372677

Summary: Use `systemctl kill` in logrotate postrotate script
Product: [Fedora] Fedora Reporter: Marcos Mello <marcosfrm>
Component: lighttpdAssignee: Gwyn Ciesla <gwync>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 42CC: gwync, rhbugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: lighttpd-1.4.79-2.fc41 lighttpd-1.4.79-2.fc42 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-06-22 01:14:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcos Mello 2025-06-13 12:57:34 UTC
`systemctl kill` leverages systemd's knowledge of the daemon's main PID, eliminating the need to rely on PID files or external tools like `killall` or `pkill`. This ensures precise signal sending to the intended process, reducing the risk of errors in process identification. Additionally, using `systemctl kill` logs the signal sending in the service's journal, providing a record of actions taken. Requires selinux-policy-41.43 or higher (see https://bugzilla.redhat.com/show_bug.cgi?id=2369644), available as an update for F41, F42, and Rawhide.

https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb98eb9e24 (F41 -- will go to stable in a few days)
https://bodhi.fedoraproject.org/updates/FEDORA-2025-f9f097f491 (F42 -- stable)
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3db4c0ec1c (Rawhide)

The logrotate configuration snippet:

# cat /etc/logrotate.d/lighttpd

# Warning: Using logrotate together with `max-workers` Lighty option is
# a pretty complicated thing:
# https://redmine.lighttpd.net/projects/1/wiki/Docs_ModAccesslog
# If you use max-workers, you probably want cronolog, which in turn means
# you shouldn't be using logrotate at all.

/var/log/lighttpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /usr/bin/killall -HUP lighttpd &>/dev/null || :
    endscript
}

In the postrotate script, killall can be replaced by:

/usr/bin/systemctl kill --signal=HUP --kill-whom=main lighttpd.service 2>/dev/null || true

Because:

# systemctl show -P MainPID lighttpd.service
1046
# pgrep lighttpd
1046

Reproducible: Always




Additional Information:
lighttpd-1.4.79-1.fc42.x86_64

Comment 1 Fedora Update System 2025-06-13 17:10:16 UTC
FEDORA-2025-4faaf4548b (lighttpd-1.4.79-2.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-4faaf4548b

Comment 2 Fedora Update System 2025-06-13 17:10:16 UTC
FEDORA-2025-2ed0227537 (lighttpd-1.4.79-2.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-2ed0227537

Comment 3 Fedora Update System 2025-06-14 00:39:02 UTC
FEDORA-2025-4faaf4548b has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-4faaf4548b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-4faaf4548b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2025-06-14 02:19:56 UTC
FEDORA-2025-2ed0227537 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-2ed0227537`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-2ed0227537

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2025-06-22 01:14:04 UTC
FEDORA-2025-2ed0227537 (lighttpd-1.4.79-2.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2025-06-22 05:58:55 UTC
FEDORA-2025-4faaf4548b (lighttpd-1.4.79-2.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.