From 38cfab612b8b2962cd5372caf536f2a17385c9ef Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 29 Jul 2020 23:12:13 -0500 Subject: [PATCH] Dispatch Service Fix maintenance issues (#11973) If daily.sh exited with non-zero it would kill the maintenance thread, stopping daily.sh The maintenance lock was never released, this wouldn't cause an issue in normal operation as it should expire. --- LibreNMS/service.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/LibreNMS/service.py b/LibreNMS/service.py index 791d91af1a..d695dae447 100644 --- a/LibreNMS/service.py +++ b/LibreNMS/service.py @@ -429,8 +429,13 @@ class Service: sleep(wait) info("Running maintenance tasks") - output = LibreNMS.call_script('daily.sh') - info("Maintenance tasks complete\n{}".format(output)) + try: + output = LibreNMS.call_script('daily.sh') + info("Maintenance tasks complete\n{}".format(output)) + except subprocess.CalledProcessError as e: + error("Error in daily.sh:\n" + (e.output.decode() if e.output is not None else 'No output')) + + self._lm.unlock('schema-update', self.config.unique_name) self.restart()