mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-19 23:10:46 +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.')
|
log.info('Finished reloading PyLink configuration.')
|
||||||
|
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
# Only register SIGHUP on *nix.
|
# Only register SIGHUP/SIGUSR1 on *nix.
|
||||||
def sighup_handler(_signo, _stack_frame):
|
def sigusr1_handler(_signo, _stack_frame):
|
||||||
"""Handles SIGHUP by rehashing the PyLink daemon."""
|
"""Handles SIGUSR1 by rehashing the PyLink daemon."""
|
||||||
log.info("SIGHUP received, reloading config.")
|
log.info("SIGUSR1 received, reloading config.")
|
||||||
_rehash()
|
_rehash()
|
||||||
|
|
||||||
signal.signal(signal.SIGHUP, sighup_handler)
|
signal.signal(signal.SIGUSR1, sigusr1_handler)
|
||||||
|
signal.signal(signal.SIGHUP, sigterm_handler)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user