From 568405dc6a219f6cc481ef93d9bf123f3b5ccdbe Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Fri, 19 Apr 2024 13:00:21 -0400 Subject: [PATCH] Configure service --- configs/systemd/user/watch-ports.service | 11 +++++++++++ scripts/watch-ports | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 configs/systemd/user/watch-ports.service diff --git a/configs/systemd/user/watch-ports.service b/configs/systemd/user/watch-ports.service new file mode 100644 index 0000000..fcdd252 --- /dev/null +++ b/configs/systemd/user/watch-ports.service @@ -0,0 +1,11 @@ +[Unit] +Description = Watch port open and close events +After=network.target + +[Service] +Type=simple +StandardOutput=syslog+console +ExecStart = python3 %h/.config/ewconfig/scripts/watch-ports + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/watch-ports b/scripts/watch-ports index 47f8e01..824f732 100755 --- a/scripts/watch-ports +++ b/scripts/watch-ports @@ -92,7 +92,7 @@ def print_changes( message = f"{proc_name} has {action} listening on {change['local']} port {change['port']}{proto_clean}" message = message[0].upper() + message[1:] if args.output_mode == "print": - print(message) + print(message, flush=True) else: logger.info(message)