diff --git a/secondary.py b/secondary.py index 6608beba75461dd53491319f11aa62e56689d492..7bb3a381866fc4cb77affacabc6bf8efa21b5a04 100644 --- a/secondary.py +++ b/secondary.py @@ -26,6 +26,12 @@ def cond_kill(p): except: pass +def cond_shutdown(s): + try: + s.shutdown(socket.SHUT_RDWR) + except: + pass + class Status: def __init__(self, log): @@ -182,6 +188,7 @@ def do_backup(hash_name, options, socket_path, mount, path): # Connect to server config/hashtoc socket config_hash = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + atexit.register(cond_shutdown, config_hash, log) config_hash.connect(socket_path) # Send secondary config to primary config_hash.makefile('w').write(open(config_path).read())