Read the statement by Michael Teeuw here.
PM2 start web browser at start up of pi4
-
I am trying to get PM2 to start firefox when I boot raspi 4 running bookworm.
I have the browsers home page set to my tinycam pro web page display (local)
It works great if I start it manually but would like it to start from my crontab -e and shut down the same way I just do not understand the syntax I need to use to get Firefox to start using crontab.
Probably making it harder than it really is…
Thanks in advance.
Jeff -
@plainbroke you could use pm2 to launch as well
in my scripts, runstart I launch firefox like this to view the MM page(on the same system)
where port is the MM portfirefox http://localhost:$port -kioskI do not know how to launch it from crontab
-
DISPLAY=:0 chromium https://www.google.com &opens the chromium web browser with google just fine, but then I get this error over and over again.
[4886:4886:1201/195513.105659:ERROR:gbm_wrapper.cc(79)] Failed to get fd for plane.: No such file or directory (2) [4886:4886:1201/195513.105747:ERROR:gbm_wrapper.cc(262)] Failed to export buffer to dma_buf: No such file or directory (2)any idea why that would be happening? It doesn’t start until the web browser actually starts up on my screen. I can ctr c and it stops and the web browser stays running like I want it to.
I made a Camera.sh and pasted.
DISPLAY=:0 chromium 192.168.1.177:8083/live & ^C
PM2 start Camera.sh
PM2 saveAND
it works kind of, the problem now is it just keeps running and loading tab after tab until I kill it.
What am I not doing correctly.? -
I figured out I had to remove the && ctrl C and now it just opens the one tab.
DISPLAY=:0 chromium http://192.168.1.177:8083/live
is all that is inside the Camera.sh file now, it now works.
So I can now start it up with crontab -e
I can use killall chromium and it shuts it down.
But then pm2 restarts it for me automatically.
How do I get pm2 to stop watching for the shut down? -
@plainbroke the app pm2 starts MUST STAY RUNNING
pm2’s job is to keep the app running. If it ends it starts it againRepeat
You can use the sleep command
while 1 == 1
do
sleep 10000
done -
@sdetweil
I just made it work, I am so happy
the commands to start it are
pm2 start 0
and to stop
pm2 stop 0
works that is how my MagicMirror starts in the mornings and stops at night…
pm2 is like magic…
Thanks for the help
I will give it a run overnight and see how crontab handles the commands.
You always have an answer that triggers my thought process to make it work.
Thank you Sam I appreciate your efforts to teach us that are not too bright… -
@plainbroke we are all learning new stuff every day!!! Glad you got it!!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login