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.

    Crontab to Restart Magic Mirror does not work

    Scheduled Pinned Locked Moved Bug Hunt
    11 Posts 3 Posters 3.3k Views 3 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 @evroom
      last edited by sdetweil

      @evroom good catch on the uppercase pm2…

      @Desert-Rat
      everything in Linux is case sensitive

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      D 1 Reply Last reply Reply Quote 0
      • D Offline
        Desert Rat @sdetweil
        last edited by

        @sdetweil
        Thanks for the quick reply. I changed the crontab. I actually changed it to PM2 START MagicMirror.

        The process I used was to , via the terminal, pm2 stop MagicMirror. This worked and MagicMirror was stopped sucessfully.
        Crontab was updated as above PM2 START MagicMirror.
        It did not start.

        Here are the entries from the log file

        Nov 27 13:44:01 raspberrypi CRON[3620]: (pi) CMD (SUDO PM2 START MagicMirror)
        Nov 27 13:44:01 raspberrypi CRON[3618]: (CRON) info (No MTA installed, discarding output)
        Nov 27 13:55:01 raspberrypi CRON[3661]: (root) CMD (sudo pm2 restart MagicMirror)
        Nov 27 13:55:04 raspberrypi CRON[3659]: (CRON) info (No MTA installed, discarding output)
        Nov 27 14:17:01 raspberrypi CRON[3772]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)

        S evroomE 2 Replies Last reply Reply Quote 0
        • S Offline
          sdetweil @Desert Rat
          last edited by

          @desert-rat PM2 is not the command

          pm2 is the command and start is the parm

          all lower case

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • evroomE Offline
            evroom @Desert Rat
            last edited by

            @desert-rat

            Could you please show the crontab ?

            $ crontab -l
            

            To get rid of this:

            (CRON) info (No MTA installed, discarding output)
            

            you have to add >/dev/null 2>&1

            Try:

            44 * * * * /usr/local/bin/pm2 start MagicMirror >/dev/null 2>&1
            

            MagicMirror version: 2.30.0
            Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            Test environment:
            MagicMirror version: v2.30.0
            Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            1 Reply Last reply Reply Quote 0
            • D Offline
              Desert Rat
              last edited by

              Problem resolved! Outstanding.

              My thanks to all who responded.

              My mission now is to research the provided solution and try to understand why it worked. Clearly the devil is in the details.

              Thanks again to all of you

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

                @desert-rat said in Crontab to Restart Magic Mirror does not work:

                to understand why it worked.

                your crontab entry

                44 * * * * PM2 restart MagicMirror
                

                the working crontab entry

                44 * * * * /usr/local/bin/pm2 start MagicMirror >/dev/null 2>&1
                

                could be restart as well…

                simple, two things

                cron runs as root, BUT certain folders are not in the path
                so you need to specify the path to the command

                 /usr/local/bin/
                

                second the command is pm2, you tried PM2
                in linux EVERYTHING is case sensitive

                so yours is command not found, cause there is no command named PM2

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                D 1 Reply Last reply Reply Quote 0
                • D Offline
                  Desert Rat @sdetweil
                  last edited by

                  @sdetweil Thanks Sam! I clearly need some education. Do you have a favorite set of training documentation for newbies

                  Desert Rat

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

                    @desert-rat sorry. no idea. my info is gathered over 20+ years

                    there are online linux courses, but I don’t know where they start, or how deep they go, how fast.

                    I have a near photographic memory which is a blessing and a curse…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

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