@@ -93,6 +93,7 @@ def apache_notify(self, status):
93
93
elif 'inactive (dead)' in self .validate_apache ():
94
94
new_port = 'Inactive'
95
95
96
+
96
97
if (self .current_port != new_port ) and (new_port == "Active" ) and (a_status != 'restart' ):
97
98
subprocess .run ('notify-send -i /Media/bitmap.png -u low "Apache Status" "Has been activated"' , stdout = subprocess .PIPE , text = True , shell = True )
98
99
@@ -138,7 +139,7 @@ def mysql_notify(self, status):
138
139
elif (a_mysql == 'restart' ) and (new_port == "Active" ):
139
140
subprocess .run ('notify-send -i /Media/bitmap.png -u low "MySQL Status" "Service restarted"' , stdout = subprocess .PIPE , text = True , shell = True )
140
141
141
- elif (a_mysql == 'restart' ) and (new_port == "Inactive" ):
142
+ elif (a_mysql == 'restart' ) and (new_port == "Inactive" ) and ( a_mysql != 'Inactive' ) :
142
143
subprocess .run ('notify-send -i /Media/bitmap.png -u low "MySQL Status" "Could not restart"' , stdout = subprocess .PIPE , text = True , shell = True )
143
144
144
145
else :
@@ -344,6 +345,7 @@ class CurrentServiceStatus(Handler):
344
345
def __init__ (self , * args ):
345
346
super ().__init__ ()
346
347
348
+
347
349
while True :
348
350
349
351
try :
@@ -427,18 +429,14 @@ def __init__(self, *args):
427
429
self .ftpd_img_status .set_from_icon_name ('emblem-important' , 1 )
428
430
429
431
self .ftp_port .set_text ('Not found' )
432
+ sleep (10 )
430
433
431
- sleep (5 )
432
-
433
- main_thread = CurrentServiceStatus
434
- thread = threading .Thread (target = main_thread )
435
- thread .daemon = True
434
+ thread = threading .Thread (target = CurrentServiceStatus , daemon = True )
436
435
thread .start ()
437
436
438
-
439
437
builder .connect_signals (Handler ())
440
438
window = builder .get_object ('main_window' )
441
439
window .show_all ()
442
440
443
441
if __name__ == '__main__' :
444
- Gtk .main ()
442
+ Gtk .main ()
0 commit comments