Skip to content

Improve chrome refesh after a crash#367

Merged
guysoft merged 2 commits intoguysoft:develfrom
yrien30:devel
Aug 23, 2021
Merged

Improve chrome refesh after a crash#367
guysoft merged 2 commits intoguysoft:develfrom
yrien30:devel

Conversation

@yrien30
Copy link
Contributor

@yrien30 yrien30 commented Feb 19, 2021

Since chrome_debug.log is re-created by chrome when it start. tail should use the -F flag instead of the -f flag.
https://unix.stackexchange.com/questions/410471/tail-f-but-when-the-file-is-deleted-and-re-created-not-appended

I suggest also to add a 1 second delay before refeshing chrome after a crash.

@guysoft
Copy link
Owner

guysoft commented Mar 4, 2021

Hey,

  1. why add --follow=name --retry? Did you get IO issues with the file? I mean it seems to work here.
  2. Also, would it be better to add sleep 0.5? Sorry if its a little pedantic, but it seems that if there is an error in the log, a refresh should happen right away.

The thing is I never really found a way to test all this and it would help if you had a spesific page or something that this solves the issue for. Otherwise I am pulling without any proof that it helps anyone.

@yrien30
Copy link
Contributor Author

yrien30 commented Mar 4, 2021

  1. why add --follow=name --retry? Did you get IO issues with the file? I mean it seems to work here.

Did not work in my case whit -f. It makes sense since chrome is deleting the logs when it starts. If you use -f then it will stop watching the file for changes after the file is deleted. When I switch to -F it works.

  1. Also, would it be better to add sleep 0.5? Sorry if its a little pedantic, but it seems that if there is an error in the log, a refresh should happen right away.

That may also work. (not tested this) I add delay because when I navigate to chrome://crash to simulate a crash then it does not refesh unless I add a delay.

@guysoft
Copy link
Owner

guysoft commented Mar 4, 2021

Ok,
Will merge this after 0.12.0 which is in RC is out, then it will go to the nightly

@yrien30
Copy link
Contributor Author

yrien30 commented May 7, 2021

Another way of doing it:

RestartOnCrash()
{
 while read LOGLINE; do
   if [[ $LOGLINE == *"ERROR"* ]] || [[ $LOGLINE == *"FATAL"* ]]; then
     echo "Refreshing after crash"
     echo "Restarting at `date` after a reported crash. Logline: ${LOGLINE}" >> /tmp/crashlog
     exec /home/pi/scripts/refresh
   fi
 done
}

chromium-browser --enable-logging=stderr --log-level=2 --v=0 2>&1 | RestartOnCrash

@guysoft
Copy link
Owner

guysoft commented Aug 12, 2021

Hey, did that branch change? I see no relevant code anymore

@yrien30
Copy link
Contributor Author

yrien30 commented Aug 13, 2021

Hey, did that branch change? I see no relevant code anymore

Hey. I didn't change anything. I just sent you how I ended up writing the log file. I have changed it after this to log to /var/syslog/chrome and have log rotation on this file.

@guysoft guysoft merged commit 8aca011 into guysoft:devel Aug 23, 2021
dwarf6 pushed a commit to dwarf6/FullPageOS64 that referenced this pull request Feb 19, 2026
Improve chrome refesh after a crash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants