diff --git a/hbd/client/main.py b/hbd/client/main.py index dd9ccce..ce05c62 100644 --- a/hbd/client/main.py +++ b/hbd/client/main.py @@ -524,6 +524,13 @@ async def async_main(args, config): loop = asyncio.get_event_loop() for sig in (signal.SIGTERM, signal.SIGINT): loop.add_signal_handler(sig, stop) + + def _sighup(): + global dorestart + dorestart = True + stop() + + loop.add_signal_handler(signal.SIGHUP, _sighup) # Start async tasks # Heartbeat senders (one per connection) diff --git a/scripts/hbc_mini.py b/scripts/hbc_mini.py index 25fef8b..735aad8 100755 --- a/scripts/hbc_mini.py +++ b/scripts/hbc_mini.py @@ -1066,6 +1066,13 @@ async def _async_main(args, cfg: Dict[str, Any]) -> int: for sig in (signal.SIGTERM, signal.SIGINT): loop.add_signal_handler(sig, _stop) + def _sighup(): + global _dorestart + _dorestart = True + _stop() + + loop.add_signal_handler(signal.SIGHUP, _sighup) + for conn in connections: _active_tasks.append(asyncio.create_task(_heartbeat_sender(conn, interval)))