.
This commit is contained in:
@@ -5,6 +5,7 @@ gi.require_version("Gtk", "3.0")
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gio
|
||||
from gi.repository import GLib
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
@@ -80,24 +81,22 @@ class Main:
|
||||
"rmt-server-sync.timer",
|
||||
"rmt-server-mirror.timer",
|
||||
"rmt-server-systems-scc-sync.timer",
|
||||
"atftp.socket",
|
||||
"atftpd.socket",
|
||||
"mariadb"
|
||||
]
|
||||
|
||||
self.update()
|
||||
|
||||
|
||||
def update(self):
|
||||
logging.debug("Update triggered")
|
||||
self.check_service()
|
||||
self.check_ip()
|
||||
timer_thread = threading.Thread(target=self.sleep)
|
||||
timer_thread = threading.Thread(target=self.update)
|
||||
timer_thread.daemon = True
|
||||
timer_thread.start()
|
||||
|
||||
def sleep(self):
|
||||
time.sleep(SLEEPTIMER)
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
while True:
|
||||
logging.debug("Update triggered")
|
||||
GLib.idle_add(self.check_service)
|
||||
GLib.idle_add(self.check_ip)
|
||||
time.sleep(SLEEPTIMER)
|
||||
|
||||
|
||||
def check_service(self):
|
||||
for service in self.service_checks:
|
||||
@@ -106,10 +105,10 @@ class Main:
|
||||
result = subprocess.run(["systemctl", "is-active", service, "--quiet"])
|
||||
if result.returncode == 0:
|
||||
logging.debug("%s is running", service)
|
||||
image.set_from_gicon(self.icon_ok, Gtk.IconSize.DIALOG)
|
||||
image.set_from_gicon(self.icon_ok, Gtk.IconSize.BUTTON)
|
||||
else:
|
||||
logging.debug("%s is not running, exit code %i",service, result.returncode)
|
||||
image.set_from_gicon(self.icon_not_ok, Gtk.IconSize.DIALOG)
|
||||
image.set_from_gicon(self.icon_not_ok, Gtk.IconSize.BUTTON)
|
||||
|
||||
def check_ip(self):
|
||||
#checking LAN network
|
||||
|
Reference in New Issue
Block a user