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