parent
c5a7ac0738
commit
9eb1855add
6
pvcd.py
6
pvcd.py
|
@ -143,7 +143,7 @@ zk_conn.add_listener(zk_listener)
|
||||||
|
|
||||||
# Cleanup function
|
# Cleanup function
|
||||||
def cleanup():
|
def cleanup():
|
||||||
ansiiprint.echo('Clearing daemon', '', 'w')
|
ansiiprint.echo('Terminating daemon', '', 'e')
|
||||||
# Set stop state in Zookeeper
|
# Set stop state in Zookeeper
|
||||||
zk_conn.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii'))
|
zk_conn.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii'))
|
||||||
# Close the Zookeeper connection
|
# Close the Zookeeper connection
|
||||||
|
@ -158,7 +158,7 @@ def flush():
|
||||||
|
|
||||||
# Shutdown function
|
# Shutdown function
|
||||||
def dshutdown(signum, frame):
|
def dshutdown(signum, frame):
|
||||||
ansiiprint.echo('Flushing this node', '', 'w')
|
ansiiprint.echo('Flushing this node', '', 'e')
|
||||||
flush()
|
flush()
|
||||||
ansiiprint.echo('NOTE: This node must be unflushed by the administrator after daemon startup', '', 'i')
|
ansiiprint.echo('NOTE: This node must be unflushed by the administrator after daemon startup', '', 'i')
|
||||||
cleanup()
|
cleanup()
|
||||||
|
@ -168,7 +168,7 @@ def dshutdown(signum, frame):
|
||||||
def dreload(signum, frame):
|
def dreload(signum, frame):
|
||||||
cleanup()
|
cleanup()
|
||||||
python = sys.executable
|
python = sys.executable
|
||||||
os.exec(python, python, *sys.argv)
|
os.execl(python, python, *sys.argv)
|
||||||
|
|
||||||
# Handle signals gracefully
|
# Handle signals gracefully
|
||||||
signal.signal(signal.SIGTERM, dshutdown)
|
signal.signal(signal.SIGTERM, dshutdown)
|
||||||
|
|
Loading…
Reference in New Issue