• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 doesnt work with crontab

Scheduled Pinned Locked Moved Troubleshooting
27 Posts 6 Posters 6.7k Views 5 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.
  • P Offline
    plainbroke @Assassins
    last edited by Jul 18, 2023, 2:31 AM

    @Assassins
    I would like to see this script. Please.

    1 Reply Last reply Reply Quote 0
    • P Offline
      plainbroke
      last edited by Jul 19, 2023, 10:06 PM

      This is all I use in my crontab -e
      15 07 * * * pm2 start mm
      30 21 * * * pm2 stop all
      Shuts MM down at 9:30 pm
      Starts MM backup at 7:15 am
      EVERYDAY.
      I have a Black background color and the bar at the bottom using black background which makes it look like the screen is off basically.
      That way it doesn’t flood the room with light at night.
      Also less read / writes to the ssd drive I use for my MM.

      P 1 Reply Last reply Jan 25, 2025, 2:15 AM Reply Quote 0
      • P Offline
        plainbroke @plainbroke
        last edited by Jan 25, 2025, 2:15 AM

        @sdetweil
        My old crontab does not work in debian 12 aka bookworm
        Is there something i need to add to it to get it to work again?
        Really liked how it worked and the fact that I was getting a fresh restart of mm every morning…

        15 07 * * * pm2 start mm
        30 21 * * * pm2 stop all
        

        Tried this too.

        15 07 * * * pi  pm2 start mm
        30 21 * * * pi  pm2 stop all
        
        S 1 Reply Last reply Jan 25, 2025, 2:25 AM Reply Quote 0
        • S Offline
          sdetweil @plainbroke
          last edited by Jan 25, 2025, 2:25 AM

          @plainbroke what userid did the pm2 jobs get created under?

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          P 1 Reply Last reply Jan 25, 2025, 5:10 PM Reply Quote 0
          • P Offline
            plainbroke @sdetweil
            last edited by plainbroke Jan 25, 2025, 5:12 PM Jan 25, 2025, 5:10 PM

            @sdetweil
            pi is my user. I know not very original or safe but it is on a closed network.
            that is why I tried the pi user in the crontab.
            and it shows up when I do crontab -l.
            So I think it is setup under pi correctly.
            Do I need to do it as root sudo crontab -e and use pi or root as the user?

            S K 2 Replies Last reply Jan 25, 2025, 5:27 PM Reply Quote 0
            • S Offline
              sdetweil @plainbroke
              last edited by Jan 25, 2025, 5:27 PM

              @plainbroke no. what fo the pm2 logs show?

              pm2 logs --lines=xxx
              xxx is number of most recent lines, default 15

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              P 1 Reply Last reply Jan 25, 2025, 9:41 PM Reply Quote 0
              • K Offline
                karsten13 @plainbroke
                last edited by Jan 25, 2025, 5:29 PM

                @plainbroke

                you can do cron restart with pm2 too, see https://pm2.keymetrics.io/docs/usage/restart-strategies/

                S 1 Reply Last reply Jan 25, 2025, 10:23 PM Reply Quote 0
                • P Offline
                  plainbroke @sdetweil
                  last edited by Jan 25, 2025, 9:41 PM

                  This post is deleted!
                  S 1 Reply Last reply Jan 25, 2025, 9:44 PM Reply Quote 0
                  • S Offline
                    sdetweil @plainbroke
                    last edited by sdetweil Jan 25, 2025, 10:24 PM Jan 25, 2025, 9:44 PM

                    @plainbroke i mean after cron trying to start
                    pm2

                    set a cron entry for an hour from now stop MagicMirror and flush the logs

                    pm2 stop all
                    pm2 flush

                    see what the logs say then

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    P 1 Reply Last reply Jan 26, 2025, 2:24 AM Reply Quote 0
                    • S Offline
                      sdetweil @karsten13
                      last edited by Jan 25, 2025, 10:23 PM

                      @karsten13 yes, but he wants stop and start

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      • 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