X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fsystemd%2Ffiles%2Fsystemd-cleanup-failed;fp=modules%2Fsystemd%2Ffiles%2Fsystemd-cleanup-failed;h=3c0a3b68fea44cdf3fc9eb4e10c7d09a05fafab0;hb=76ca91bce24ecbcbcc4e62a37aa06fd0fb9f96c7;hp=0000000000000000000000000000000000000000;hpb=46cee04ab06b23ab6e9e4baba655cf470d10cfc4;p=mirror%2Fdsa-puppet.git diff --git a/modules/systemd/files/systemd-cleanup-failed b/modules/systemd/files/systemd-cleanup-failed new file mode 100755 index 000000000..3c0a3b68f --- /dev/null +++ b/modules/systemd/files/systemd-cleanup-failed @@ -0,0 +1,16 @@ +#!/bin/bash + +# if a client goes away on socket activated connections before systemd launches +# the process, things go sad and result in failed services. +# +# cf. https://github.com/systemd/systemd/issues/7172 +# +# should be fixed in buster and newer, but for now clean those up. + +systemctl --failed --no-legend | awk '{print $1}' | \ + while read service; do + if [[ $service =~ ^rsyncd-[a-z0-9-]*@.*\.service$ ]] || + [[ $service =~ ^session-[0-9]+\.scope$ ]]; then + systemctl reset-failed "$service" + fi +done