mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-24 09:10:16 -06:00
checkIfFirstRunSinceBoot code simplicity
This commit is contained in:
parent
dffd5e1a33
commit
0945a09f93
@ -68,19 +68,15 @@ def shellReturn(command):
|
||||
return returnableString
|
||||
|
||||
def checkIfFirstRunSinceBoot():
|
||||
if os.path.isfile("lastRun.txt"):
|
||||
systemRunningSince = datetime.fromtimestamp(psutil.boot_time())
|
||||
if !os.path.isfile("lastRun.txt") or systemRunningSince < lastRun:
|
||||
with open("lastRun.txt", 'r') as file:
|
||||
lastRun = datetime.strptime(file.read(), "%d-%b-%Y (%H:%M:%S.%f)")
|
||||
systemRunningSince = datetime.fromtimestamp(psutil.boot_time())
|
||||
if systemRunningSince > lastRun:
|
||||
print("First time run since system boot.")
|
||||
return True
|
||||
else:
|
||||
print("Not first time run since system boot.")
|
||||
return False
|
||||
else:
|
||||
print("First time run since system boot.")
|
||||
return True
|
||||
|
||||
def clearPriorSettings(interfaceA, interfaceB):
|
||||
if enable_actual_shell_commands():
|
||||
|
Loading…
Reference in New Issue
Block a user