mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-09 15:00:21 -04:00
finished bgservice
This commit is contained in:
parent
8b11e2defe
commit
aecdb3b4f1
24
skoolos.py
24
skoolos.py
|
@ -88,11 +88,9 @@ def main():
|
|||
USER = data['username']
|
||||
print(data['username'])
|
||||
if data['is_student']:
|
||||
empty_logs()
|
||||
bg.watch_dir()
|
||||
# bg.watch_dir()
|
||||
# atexit.register(stop_bg_service)
|
||||
studentCLI(USER, PWD)
|
||||
|
||||
atexit.register(stop_bg_service)
|
||||
else:
|
||||
teacherCLI(USER, PWD)
|
||||
|
||||
|
@ -103,26 +101,14 @@ def stop_bg_service():
|
|||
print("good")
|
||||
bg.stop_watching()
|
||||
print('also')
|
||||
cur_path = os.path.dirname(__file__)
|
||||
cur_path = os.path.dirname('') # Change to definite SkoolOS dir
|
||||
print('yes')
|
||||
newpath = os.path.relpath('bgservice/SkoolOS/logs')
|
||||
newpath = os.path.relpath('bgservice/SkoolOS/logs/')
|
||||
logText = ""
|
||||
with open(newpath, 'r') as logfile:
|
||||
with open(newpath + '/skooloslog', 'r') as logfile:
|
||||
logfile.read()
|
||||
print (logText)
|
||||
|
||||
def empty_logs():
|
||||
logs_folder = os.path.dirname(__file__) + 'bgservice/SkoolOS/logs/'
|
||||
for filename in os.listdir(logs_folder):
|
||||
file_path = os.path.join(logs_folder, filename)
|
||||
try:
|
||||
if os.path.isfile(file_path) or os.path.islink(file_path):
|
||||
os.unlink(file_path)
|
||||
elif os.path.isdir(file_path):
|
||||
shutil.rmtree(file_path)
|
||||
except Exception as e:
|
||||
print('Failed to delete %s. Reason: %s' % (file_path, e))
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user