From 8f069999ce0cab99d24ee88f324e73f92bffd29f Mon Sep 17 00:00:00 2001
From: Ales Seifert <seifert@alesak.net>
Date: Thu, 28 Nov 2019 21:27:03 +1100
Subject: [PATCH] added update status check for Redhat based distros

---
 .../cron.d/100-monitor_system_update.inc.php  | 24 ++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/server/lib/classes/cron.d/100-monitor_system_update.inc.php b/server/lib/classes/cron.d/100-monitor_system_update.inc.php
index bc4f521073..3d4ebf408e 100644
--- a/server/lib/classes/cron.d/100-monitor_system_update.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_system_update.inc.php
@@ -159,7 +159,29 @@ class cronjob_monitor_system_update extends cronjob {
 			 * Fetch the output
 			 */
 			$data['output'] = shell_exec('zypper lu');
-		} else {
+		} elseif(file_exists('/etc/redhat-release')) {
+			/*
+			 * update and find the upgrade.
+			 * if there is any output, then there is a needed update
+			 */
+			$aptData = shell_exec('yum -q list updates');
+			if ($aptData == '') {
+				/* There is nothing to update! */
+				$state = 'ok';
+			} else {
+				/*
+				 * There is something to update! this is in most cases not critical, so we can
+				 * do a system-update once a month or so...
+				 */
+				$state = 'info';
+			}
+
+			/*
+			 * Fetch the output
+			 */
+			$data['output'] = shell_exec('yum -q list updates');
+            
+        } else {
 			/*
 			 * It is not Debian/Ubuntu, so there is no data and no state
 			 *
-- 
GitLab