Add proper exit
This commit is contained in:
parent
261d9394db
commit
313181f48f
3
pvcd.py
3
pvcd.py
|
@ -116,10 +116,11 @@ zk.add_listener(zk_listener)
|
||||||
|
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def cleanup():
|
def cleanup():
|
||||||
|
update_timer.shutdown()
|
||||||
zk.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii'))
|
zk.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii'))
|
||||||
zk.stop()
|
zk.stop()
|
||||||
zk.close()
|
zk.close()
|
||||||
update_timer.shutdown()
|
exit(0)
|
||||||
|
|
||||||
# Handle SIGTERM gracefully
|
# Handle SIGTERM gracefully
|
||||||
signal.signal(signal.SIGTERM, cleanup)
|
signal.signal(signal.SIGTERM, cleanup)
|
||||||
|
|
Loading…
Reference in New Issue