0115f93b6ee55b0f2d0f4379228d0b53bd1804a3
[mirror/dsa-puppet.git] / modules / systemd / files / systemd-cleanup-failed
1 #!/bin/bash
2
3 # if a client goes away on socket activated connections before systemd launches
4 # the process, things go sad and result in failed services.
5 #
6 # cf. https://github.com/systemd/systemd/issues/7172
7 #
8 # should be fixed in buster and newer, but for now clean those up.
9
10 systemctl --failed --no-legend | awk '{print $1}' | \
11     while read service; do
12     if [[ $service =~ ^rsyncd-[a-z]*@.*\.service$ ]] ||
13        [[ $service =~ ^session-[0-9]+\.scope$ ]]; then
14         systemctl reset-failed "$service"
15     fi
16 done