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 9.5k 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.
    • S Offline
      sdetweil @keineAhnung123
      last edited by sdetweil

      @keineahnung123 u need to run pm2 as the user that did the save and where mm was running. it cannot be rootScreenshot_20210227-074511_Chrome.jpg

      you also create a user specific crontab in /var/spool/cron
      user needs to own the file, then username is not required on the contab entries themselves

      Each user, including root, can have a cron file. These files don't exist by default, but can be created in the /var/spool/cron directory using the crontab -e command that's also
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      K 1 Reply Last reply Reply Quote 0
      • K Offline
        keineAhnung123 @sdetweil
        last edited by

        @sdetweil Thanks.

        With

        sudo nano /etc/crontab
        

        and

        30 16   * * *   pi      /home/pi/.config/nvm/versions/node/v10.23.0/bin/node /home/pi/.config/nvm/versions/node/v10.23.0/bin/pm2 stop mm
        

        it seems to work :)

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @keineAhnung123
          last edited by

          @keineahnung123 i don’t think u need those paths now

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          K 1 Reply Last reply Reply Quote 0
          • K Offline
            keineAhnung123 @sdetweil
            last edited by keineAhnung123

            @sdetweil

            45 16   * * *   pi      pm2 stop mm
            

            doesnt work. I have to set the paths.

            I think there went something wrong when i upgraded to buster.
            I had a shellscript with

            cd ~/MagicMirror && npm start
            

            which worked fine and after the upgrade to buster i have to use

            cd ~/MagicMirror && /home/pi/.config/nvm/versions/node/v10.23.0/bin/npm start
            

            otherwise it says “npm: not found”

            Same seems to be with crontab…

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @keineAhnung123
              last edited by

              @keineahnung123 looks like u need to reinstall nvm

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              K 1 Reply Last reply Reply Quote 0
              • K Offline
                keineAhnung123 @sdetweil
                last edited by

                @sdetweil said in pm2 doesnt work with crontab:

                @keineahnung123 looks like u need to reinstall nvm

                nvm or npm?

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @keineAhnung123
                  last edited by

                  @keineahnung123 nvm

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • AssassinsA Offline
                    Assassins @keineAhnung123
                    last edited by

                    @keineahnung123
                    Hello, i Can send you a script om monday, where you make backup to a small .img and where is restart you MagicMirror on the same time.

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

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

                      Slow learner. But trying anyways.

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

                        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.

                        Slow learner. But trying anyways.

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