From 21e03179798ba543eb65b85d9496609bd6bfb844 Mon Sep 17 00:00:00 2001 From: Samuel Sloniker Date: Sat, 6 May 2023 09:22:10 -0700 Subject: [PATCH] Re-add pid file --- adsms.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/adsms.py b/adsms.py index 60125e0..5e2c384 100755 --- a/adsms.py +++ b/adsms.py @@ -83,4 +83,13 @@ if __name__ == "__main__": args = parser.parse_args() config = load_config(args.config_file) - run(config) + + try: + if config["pid_file"]: + with open(config["pid_file"], "w+") as f: + f.write(str(os.getpid())) + + run(config) + finally: + if config["pid_file"]: + os.unlink(config["pid_file"])