diff --git a/bgservice/__init__.py b/bgservice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/BackgroundService/bgservice.py b/bgservice/bgservice.py similarity index 94% rename from BackgroundService/bgservice.py rename to bgservice/bgservice.py index e2c4411..db0f15e 100644 --- a/BackgroundService/bgservice.py +++ b/bgservice/bgservice.py @@ -76,14 +76,15 @@ class EventHandler(pyinotify.ProcessEvent): NOTIFIER = None +STDOUT = sys.stdout def watch_dir(watched_dir="/tmp", logdir="/tmp/skooloslogs"): if not os.path.exists(logdir): os.makedirs(logdir) logfile = open( - logdir + "skoolos_" + time.strftime("%m%d%Y-%H%M%S", time.localtime()), - 'w') + logdir + "/skoolos_" + + time.strftime("%m%d%Y-%H%M%S", time.localtime()), 'w') sys.stdout = logfile print("Start time: " + 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(): NOTIFIER.stop() 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")