bgservice.py

This commit is contained in:
Nathaniel Kenschaft 2020-06-16 23:15:29 -04:00
parent 8a5e1d2f86
commit ef37a15ac8

View File

@ -7,7 +7,7 @@ import time
import sys import sys
import os import os
import pyinotify import pyinotify
from . import checker import checker
from pathlib import Path from pathlib import Path
@ -135,9 +135,10 @@ def watch_dir(watched_dir=str(Path.home()), log_dir="SkoolOS/logs"):
DIR = watched_dir DIR = watched_dir
if not os.path.exists(log_dir): if not os.path.exists(log_dir):
os.makedirs(log_dir) os.makedirs(log_dir)
logfile = open( logfile_ = log_dir + "/skooloslog"
log_dir + "/skoolos_" + logfile = open(logfile_, 'w')
time.strftime("%m%d%Y-%H%M%S", time.localtime()), 'w') if os.path.isfile(logfile_):
os.remove(logfile_)
START_TIME = time.time() START_TIME = time.time()
wm = pyinotify.WatchManager() wm = pyinotify.WatchManager()
mask = pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE | pyinotify.IN_DELETE | \ mask = pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE | pyinotify.IN_DELETE | \