From 991962ded29e379c417f52f19ca36f146a0d836f Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Thu, 4 Mar 2021 12:27:17 -0600 Subject: Add periodic restart. PKF will run for about 800 min before stopping and expecting the process be restarted by angel or monit. Gateways have been seen to stop transmitting if left running for several consecutive days, restarting the process restored functionality --- lora_pkt_fwd/src/lora_pkt_fwd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c index 2969053..a181ea7 100644 --- a/lora_pkt_fwd/src/lora_pkt_fwd.c +++ b/lora_pkt_fwd/src/lora_pkt_fwd.c @@ -1994,8 +1994,18 @@ int main(int argc, char** argv) break; } - /* read the currrent temperature */ + static uint32_t last_tstamp = 0; + static uint32_t rollover_cnt = 0; + if (trig_tstamp < last_tstamp) { + if (rollover_cnt++ > 10) { + exit_sig = true; + MSG("INFO: periodic restart, process is exiting.\n"); + break; + } + } + last_tstamp = trig_tstamp; + /* read the currrent temperature */ pthread_mutex_unlock(&mx_concent); if (i != LGW_HAL_SUCCESS) { printf("# SX1301 time (PPS): unknown\n"); -- cgit v1.2.3