mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 13:09:23 +01:00
control: move rehash signal to SIGUSR1, and shutdown on SIGHUP (terminal close)
PyLink technically isn't a daemon, so it's a bit odd to have it linger around after the controlling terminal has died.
This commit is contained in:
parent
f0fab0c0ad
commit
883f9199ec
@ -138,10 +138,11 @@ def _rehash():
|
||||
log.info('Finished reloading PyLink configuration.')
|
||||
|
||||
if os.name == 'posix':
|
||||
# Only register SIGHUP on *nix.
|
||||
def sighup_handler(_signo, _stack_frame):
|
||||
"""Handles SIGHUP by rehashing the PyLink daemon."""
|
||||
log.info("SIGHUP received, reloading config.")
|
||||
# Only register SIGHUP/SIGUSR1 on *nix.
|
||||
def sigusr1_handler(_signo, _stack_frame):
|
||||
"""Handles SIGUSR1 by rehashing the PyLink daemon."""
|
||||
log.info("SIGUSR1 received, reloading config.")
|
||||
_rehash()
|
||||
|
||||
signal.signal(signal.SIGHUP, sighup_handler)
|
||||
signal.signal(signal.SIGUSR1, sigusr1_handler)
|
||||
signal.signal(signal.SIGHUP, sigterm_handler)
|
||||
|
Loading…
Reference in New Issue
Block a user