diff --git a/email/symbiosis/monit.d/clamav-daemon b/email/symbiosis/monit.d/clamav-daemon index 4e793c1d..3256b886 100755 --- a/email/symbiosis/monit.d/clamav-daemon +++ b/email/symbiosis/monit.d/clamav-daemon @@ -11,6 +11,21 @@ class ClamdCheck < Symbiosis::Monitor::Check @name = "clamd" end + # + # This is a monkey-patch for clamav under Jessie, which runs under systemd by + # default, and doesn't write a pidfile. Starting / stopping works via the + # systemd/sysvinit compatibility layer. + # + def running + `systemctl status clamav-daemon.service` + if $? and $?.success? + puts "Found clamav-daemon running via systemctl" + return true + end + + super + end + def do_check # # Check the initscript. If it is missing, make sure that the process is @@ -26,7 +41,7 @@ class ClamdCheck < Symbiosis::Monitor::Check end r = do_process_check - if SystemExit::EX_TEMPFAIL == r + if SystemExit::EX_TEMPFAIL == r should_be_running ? self.start : self.stop end return r @@ -37,12 +52,12 @@ class ClamdCheck < Symbiosis::Monitor::Check end # - # Ignore the test if - # * dpkg if running + # Ignore the test if + # * dpkg if running # * the initscript is missing and clamav should not be running. # def should_ignore? - self.class.dpkg_running? or + self.class.dpkg_running? or (not File.exist?(@process.initscript) and not should_be_running) end end diff --git a/email/symbiosis/monit.d/clamav-freshclam b/email/symbiosis/monit.d/clamav-freshclam index 98b289de..670a3e18 100755 --- a/email/symbiosis/monit.d/clamav-freshclam +++ b/email/symbiosis/monit.d/clamav-freshclam @@ -11,6 +11,21 @@ class FreshclamCheck < Symbiosis::Monitor::Check @name = "freshclam" end + # + # This is a monkey-patch for clamav under Jessie, which runs under systemd by + # default, and doesn't write a pidfile. Starting / stopping works via the + # systemd/sysvinit compatibility layer. + # + def running + `systemctl status clamav-freshclam.service` + if $? and $?.success? + puts "Found clamav-freshclam running via systemctl" + return true + end + + super + end + def do_check # # Check the initscript. If it is missing, make sure that the process is @@ -26,7 +41,7 @@ class FreshclamCheck < Symbiosis::Monitor::Check end r = do_process_check - if SystemExit::EX_TEMPFAIL == r + if SystemExit::EX_TEMPFAIL == r should_be_running ? self.start : self.stop end return r