MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    PM2 start web browser at start up of pi4

    Scheduled Pinned Locked Moved Tutorials
    7 Posts 2 Posters 460 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • plainbrokeP Offline
      plainbroke
      last edited by

      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

      Slow learner. But trying anyways.

      S 1 Reply Last reply Reply Quote 0
      • S Away
        sdetweil @plainbroke
        last edited by

        @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 port

        firefox http://localhost:$port  -kiosk
        

        I do not know how to launch it from crontab

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        plainbrokeP 1 Reply Last reply Reply Quote 0
        • plainbrokeP Offline
          plainbroke @sdetweil
          last edited by

          @sdetweil

          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 save

          AND

          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.?

          Slow learner. But trying anyways.

          plainbrokeP S 2 Replies Last reply Reply Quote 0
          • plainbrokeP Offline
            plainbroke @plainbroke
            last edited by

            @sdetweil

            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?

            Slow learner. But trying anyways.

            1 Reply Last reply Reply Quote 0
            • S Away
              sdetweil @plainbroke
              last edited by

              @plainbroke the app pm2 starts MUST STAY RUNNING
              pm2’s job is to keep the app running. If it ends it starts it again

              Repeat

              You can use the sleep command

              while 1 == 1
              do
              sleep 10000
              done

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              plainbrokeP 1 Reply Last reply Reply Quote 0
              • plainbrokeP Offline
                plainbroke @sdetweil
                last edited by

                @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…

                Slow learner. But trying anyways.

                S 1 Reply Last reply Reply Quote 0
                • S Away
                  sdetweil @plainbroke
                  last edited by

                  @plainbroke we are all learning new stuff every day!!! Glad you got it!!

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy