From 65db044eca916f247927517a475052318ab672cd Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 4 Feb 2018 13:07:56 +0100 Subject: [PATCH] Clean up failed rsyncs every few minutes --- modules/rsync/files/systemd-cleanup-failed-rsyncs | 15 +++++++++++++++ modules/rsync/manifests/init.pp | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100755 modules/rsync/files/systemd-cleanup-failed-rsyncs diff --git a/modules/rsync/files/systemd-cleanup-failed-rsyncs b/modules/rsync/files/systemd-cleanup-failed-rsyncs new file mode 100755 index 000000000..5cde92b45 --- /dev/null +++ b/modules/rsync/files/systemd-cleanup-failed-rsyncs @@ -0,0 +1,15 @@ +#!/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-z]*@.*\.service$ ]]; then + systemctl reset-failed "$service" + fi +done diff --git a/modules/rsync/manifests/init.pp b/modules/rsync/manifests/init.pp index 267b59c53..a80582c63 100644 --- a/modules/rsync/manifests/init.pp +++ b/modules/rsync/manifests/init.pp @@ -24,4 +24,15 @@ class rsync { rule => '&SERVICE(tcp, 873)' } + file { '/usr/local/sbin/systemd-cleanup-failed-rsyncs': + source => 'puppet:///modules/rsync/systemd-cleanup-failed-rsyncs', + mode => '0555', + } + file { '/etc/cron.d/puppet-crazy-multipath-restart': ensure => absent, } + concat::fragment { 'dsa-puppet-stuff--systemd-cleanup-failed-rsyncs': + target => '/etc/cron.d/dsa-puppet-stuff', + content => @("EOF"), + */10 * * * * root /usr/local/sbin/systemd-cleanup-failed-rsyncs + | EOF + } } -- 2.20.1