feat: restart on SIGHUP in hbc and hbc_mini

Sets dorestart and triggers a clean shutdown; os.execv re-execs
the process with the original arguments after cleanup.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andreas Wrede
2026-05-02 10:06:26 -04:00
parent 5523c60866
commit 2bd3a9beb6
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -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)