From: Peter Palfrader Date: Sun, 11 Feb 2018 09:58:08 +0000 (+0100) Subject: Move failed rsync cleanup into systemd module X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=08a21d49a4973b76493e3a50d25c3e98f07cb92b;p=mirror%2Fdsa-puppet.git Move failed rsync cleanup into systemd module --- diff --git a/modules/rsync/files/systemd-cleanup-failed-rsyncs b/modules/rsync/files/systemd-cleanup-failed-rsyncs deleted file mode 100755 index 5cde92b45..000000000 --- a/modules/rsync/files/systemd-cleanup-failed-rsyncs +++ /dev/null @@ -1,15 +0,0 @@ -#!/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 a80582c63..686843ced 100644 --- a/modules/rsync/manifests/init.pp +++ b/modules/rsync/manifests/init.pp @@ -25,14 +25,6 @@ class rsync { } 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 + ensure => absent, } } diff --git a/modules/systemd/files/systemd-cleanup-failed b/modules/systemd/files/systemd-cleanup-failed new file mode 100755 index 000000000..5cde92b45 --- /dev/null +++ b/modules/systemd/files/systemd-cleanup-failed @@ -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/systemd/manifests/init.pp b/modules/systemd/manifests/init.pp index d5b896d31..1dd41cda5 100644 --- a/modules/systemd/manifests/init.pp +++ b/modules/systemd/manifests/init.pp @@ -15,4 +15,14 @@ class systemd { } } + file { '/usr/local/sbin/systemd-cleanup-failed': + source => 'puppet:///modules/systemd/systemd-cleanup-failed', + mode => '0555', + } + concat::fragment { 'dsa-puppet-stuff--systemd-cleanup-failed': + target => '/etc/cron.d/dsa-puppet-stuff', + content => @("EOF"), + */10 * * * * root /usr/local/sbin/systemd-cleanup-failed + | EOF + } }