From aeb4cc88345039c457985e641a446d4fa059f9a9 Mon Sep 17 00:00:00 2001 From: niftynei Date: Wed, 7 Aug 2024 19:23:43 -0500 Subject: [PATCH] startup-regtest: only inspect current run's logs for clnrest updates If you re-run a node several times, the log file fills with info from previous runs. To avoid looking at old logs, only parse the most recent run's logs when looking for the magic CLN rest startup/deactivated strings Changelog-Fixed: startup-regtest.sh now only inspects the most recent run's logs for the active status of the clnrest plugin --- contrib/startup_regtest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/startup_regtest.sh b/contrib/startup_regtest.sh index 642426df17db..5be5ded1461f 100755 --- a/contrib/startup_regtest.sh +++ b/contrib/startup_regtest.sh @@ -148,9 +148,9 @@ clnrest_status() { active_str="plugin-clnrest: REST server running" disabled_str="plugin-clnrest: Killing plugin: disabled itself" - if grep -q "$active_str" "$logfile"; then + if grep -n "Opened log file" "$logfile" | cut -d : -f 1 | tail -1 | xargs -I{} tail -n +{} "$logfile" | grep -q "$active_str"; then echo "active" - elif grep -q "$disabled_str" "$logfile"; then + elif grep -n "Opened log file" "$logfile" | cut -d : -f 1 | tail -1 | xargs -I{} tail -n +{} "$logfile" | grep -q "$disabled_str"; then echo "disabled" else echo "waiting"