Skip to content

Commit

Permalink
startup-regtest: only inspect current run's logs for clnrest updates
Browse files Browse the repository at this point in the history
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
  • Loading branch information
niftynei authored and daywalker90 committed Sep 22, 2024
1 parent e36ac7c commit 6af4816
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/startup_regtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,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"
Expand Down

0 comments on commit 6af4816

Please sign in to comment.