core: serialize and deserialize unit start ratelimits
The logic is taken from dump ratelimit: if the config changes, we discard the counters. This allows the user apply new limits and "start from scratch" in that case. This actually makes StartLimitIntervalSec=infinity (or with a large interval) work as expected, because the counter is maintained even if daemon-reload operations are interleaved.
This commit is contained in:
committed by
Luca Boccassi
parent
07a6647abb
commit
6ef512c0bb
@@ -7,6 +7,9 @@ set -o pipefail
|
||||
mkdir /run/systemd/system/systemd-journald.service.d
|
||||
MACHINE_ID="$(</etc/machine-id)"
|
||||
|
||||
# Reset the start-limit counters, as we're going to restart journald a couple of times
|
||||
systemctl reset-failed systemd-journald.service
|
||||
|
||||
for c in NONE XZ LZ4 ZSTD; do
|
||||
cat >/run/systemd/system/systemd-journald.service.d/compress.conf <<EOF
|
||||
[Service]
|
||||
@@ -35,4 +38,5 @@ done
|
||||
rm /run/systemd/system/systemd-journald.service.d/compress.conf
|
||||
systemctl daemon-reload
|
||||
systemctl restart systemd-journald.service
|
||||
systemctl reset-failed systemd-journald.service
|
||||
journalctl --rotate
|
||||
|
||||
@@ -88,6 +88,8 @@ do
|
||||
# Make sure we are in a consistent state, e.g. not already active before we start
|
||||
systemctl stop systemd-integritysetup@"${DM_NAME}".service || exit 1
|
||||
systemctl start systemd-integritysetup@"${DM_NAME}".service || exit 1
|
||||
# Reset the start-limit counters, as we're going to restart the service a couple of times
|
||||
systemctl reset-failed systemd-integritysetup@"${DM_NAME}".service
|
||||
|
||||
# Check the signature on the FS to ensure we can retrieve it and that is matches
|
||||
if [ -e "${FULL_DM_DEV_NAME}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user