mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-18 11:20:19 -04:00
polished bgservice
This commit is contained in:
parent
b0254f9b46
commit
964bd516ed
0
bgservice/__init__.py
Normal file
0
bgservice/__init__.py
Normal file
|
@ -76,14 +76,15 @@ class EventHandler(pyinotify.ProcessEvent):
|
||||||
|
|
||||||
|
|
||||||
NOTIFIER = None
|
NOTIFIER = None
|
||||||
|
STDOUT = sys.stdout
|
||||||
|
|
||||||
|
|
||||||
def watch_dir(watched_dir="/tmp", logdir="/tmp/skooloslogs"):
|
def watch_dir(watched_dir="/tmp", logdir="/tmp/skooloslogs"):
|
||||||
if not os.path.exists(logdir):
|
if not os.path.exists(logdir):
|
||||||
os.makedirs(logdir)
|
os.makedirs(logdir)
|
||||||
logfile = open(
|
logfile = open(
|
||||||
logdir + "skoolos_" + time.strftime("%m%d%Y-%H%M%S", time.localtime()),
|
logdir + "/skoolos_" +
|
||||||
'w')
|
time.strftime("%m%d%Y-%H%M%S", time.localtime()), 'w')
|
||||||
sys.stdout = logfile
|
sys.stdout = logfile
|
||||||
print("Start time: " +
|
print("Start time: " +
|
||||||
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()) + "\n\n")
|
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()) + "\n\n")
|
||||||
|
@ -99,4 +100,6 @@ def watch_dir(watched_dir="/tmp", logdir="/tmp/skooloslogs"):
|
||||||
def stop_watching():
|
def stop_watching():
|
||||||
NOTIFIER.stop()
|
NOTIFIER.stop()
|
||||||
print("End time: " +
|
print("End time: " +
|
||||||
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()) + "\n\n")
|
time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime()))
|
||||||
|
sys.stdout = STDOUT
|
||||||
|
print("Done watching.\n")
|
Loading…
Reference in New Issue
Block a user