diff --git a/BackgroundService/bgservice.py b/BackgroundService/bgservice.py index 11136ec..68dc111 100644 --- a/BackgroundService/bgservice.py +++ b/BackgroundService/bgservice.py @@ -12,7 +12,7 @@ class SkoolOSDaemon: self.start_time = None self.end_time = None self.log_file = None - def write_pid_file(self): + def __write_pid_file(self): pid = str(os.getpid()) file_ = open('/tmp/skoolosdaemonpid', 'w') file_.write(pid) @@ -20,6 +20,7 @@ class SkoolOSDaemon: def readable_time(self, input_time): return time.strftime("%A, %B %d, %Y %H:%M:%S", time.localtime(input_time)) def start(self): + __write_pid_file() self.start_time = time.time() self.log_file = open('/tmp/skooloslogs/' + str(self.start_time), 'w') self.log_file.write("Started work: \n" + self.readable_time(self.start_time)) @@ -32,8 +33,12 @@ class SkoolOSDaemon: time.strftime("%H:%M:%S", time.gmtime(self.end_time - self.start_time))) +logger = None + + def Main(): - print("This does nothing right now...") + logger = SkoolOSDaemon("/tmp") + logger.start() if __name__ == "__main__": diff --git a/BackgroundService/event_processor.py b/BackgroundService/event_processor.py index 00f4d8a..38dec4b 100644 --- a/BackgroundService/event_processor.py +++ b/BackgroundService/event_processor.py @@ -10,7 +10,7 @@ class EventProcessor(pyinotify.ProcessEvent): _methods = ["IN_ACCESS", "IN_CREATE", "IN_CLOSE_WRITE", - "IN_DELETE" + "IN_DELETE", "IN_MOVED_TO", "IN_MOVED_FROM", ] diff --git a/requirements.txt b/requirements.txt index 1110b47..9a6e972 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ oauthlib==3.1.0 prompt-toolkit==1.0.14 pyclipper==1.1.0.post3 Pygments==2.6.1 +pyinotify==0.9.6 PyInquirer==1.0.3 pyperclip==1.8.0 pytz==2020.1