watchdog monitoring file for changes

Instead of LoggingEventHandler define your handler: #!/usr/bin/python import time from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler class MyHandler(FileSystemEventHandler): def on_modified(self, event): print(f’event type: {event.event_type} path : {event.src_path}’) if __name__ == “__main__”: event_handler = MyHandler() observer = Observer() observer.schedule(event_handler, path=”/data/”, recursive=False) observer.start() try: while True: time.sleep(1) except KeyboardInterrupt: observer.stop() observer.join() on_modified is called when a … Read more

How can I verify if a Windows Service is running

I guess something like this would work: Add System.ServiceProcess to your project references (It’s on the .NET tab). using System.ServiceProcess; ServiceController sc = new ServiceController(SERVICENAME); switch (sc.Status) { case ServiceControllerStatus.Running: return “Running”; case ServiceControllerStatus.Stopped: return “Stopped”; case ServiceControllerStatus.Paused: return “Paused”; case ServiceControllerStatus.StopPending: return “Stopping”; case ServiceControllerStatus.StartPending: return “Starting”; default: return “Status Changing”; } Edit: There … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)