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"])