Revert "[#3] Add alternative shutdown functions to allow flushing on non-SIGHUP shutdowns"

This reverts commit d0dc923d92.
This commit is contained in:
Joshua Boniface 2018-06-26 12:10:35 -04:00
parent f27cdb024c
commit 75ed61908a
2 changed files with 3 additions and 21 deletions

23
pvcd.py
View File

@ -153,27 +153,10 @@ def cleanup(signum, frame):
# Exit # Exit
sys.exit(0) sys.exit(0)
# Flush function
def flush():
this_node = t_node[myhostname]
this_node.flush()
# Shutdown function
def dshutdown():
ansiiprint.echo('Flushing this node', '', 'e')
flush()
ansiiprint.echo('NOTE: This node must be unflushed by the administrator after daemon startup', '', 'i')
cleanup()
# Reload shutdown function
def dreload():
cleanup()
# Handle signals gracefully # Handle signals gracefully
signal.signal(signal.SIGTERM, dshutdown) signal.signal(signal.SIGTERM, cleanup)
signal.signal(signal.SIGINT, dshutdown) signal.signal(signal.SIGINT, cleanup)
signal.signal(signal.SIGQUIT, dshutdown) signal.signal(signal.SIGQUIT, cleanup)
signal.signal(signal.SIGHUP, dreload)
# Gather useful data about our host for staticdata # Gather useful data about our host for staticdata
# Static data format: 'cpu_count', 'arch', 'os', 'kernel' # Static data format: 'cpu_count', 'arch', 'os', 'kernel'

View File

@ -9,7 +9,6 @@ WorkingDirectory = /usr/share/pvc
Environment = PYTHONUNBUFFERED=true Environment = PYTHONUNBUFFERED=true
Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcd.conf Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcd.conf
ExecStart = /usr/share/pvc/pvcd.py ExecStart = /usr/share/pvc/pvcd.py
ExecReload = /bin/kill -HUP $MAINPID
Restart = on-failure Restart = on-failure
[Install] [Install]