From a7671dc1540b129e89b867f946e5096f6b8d4a88 Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Wed, 6 Jan 2021 22:21:02 +0100 Subject: [PATCH] add 10s timeout and multimon restart for rtl_fm crash --- boswatch/inputSource/sdrInput.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/boswatch/inputSource/sdrInput.py b/boswatch/inputSource/sdrInput.py index dcac725..6b1faf7 100644 --- a/boswatch/inputSource/sdrInput.py +++ b/boswatch/inputSource/sdrInput.py @@ -15,6 +15,7 @@ @description: Input source for sdr with rtl_fm """ import logging +import time from boswatch.utils import paths from boswatch.processManager import ProcessManager from boswatch.inputSource.inputBase import InputBase @@ -47,8 +48,14 @@ class SdrInput(InputBase): logging.info("start decoding") while self._isRunning: if not sdrProc.isRunning: - logging.warning("rtl_fm was down - try to restart") + logging.warning("rtl_fm was down - trying to restart in 10 seconds") + time.sleep(10) + sdrProc.start() + if sdrProc.isRunning: + logging.info("rtl_fm is back up - restarting multimon...") + mmProc.setStdin(sdrProc.stdout) + mmProc.start() elif not mmProc.isRunning: logging.warning("multimon was down - try to restart") mmProc.start()