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

Crontab to Restart Magic Mirror does not work

Scheduled Pinned Locked Moved Bug Hunt
11 Posts 3 Posters 2.4k 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.
  • E Offline
    evroom @Desert Rat
    last edited by Nov 27, 2021, 7:11 PM

    @desert-rat

    I would try pm2 iso PM2.
    And even would advise to use the full path, that can be determined using:
    which pm2

    With Debian it would be /usr/local/bin/pm2

    And you can check this log if cron did anything at all:
    /var/log/syslog

    Or edit /etc/rsyslog.conf and remove comment on the line with cron (around line 63)
    Then the dedicated cron log will be in /var/log/cron.log.
    After editing, restart with „sudo systemctl restart rsyslog“.

    Good luck,

    E.J.

    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)

    S 1 Reply Last reply Nov 27, 2021, 7:12 PM Reply Quote 0
    • S Offline
      sdetweil @evroom
      last edited by sdetweil Nov 27, 2021, 7:13 PM Nov 27, 2021, 7:12 PM

      @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 Nov 27, 2021, 9:24 PM Reply Quote 0
      • D Offline
        Desert Rat @sdetweil
        last edited by Nov 27, 2021, 9:24 PM

        @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 E 2 Replies Last reply Nov 27, 2021, 10:01 PM Reply Quote 0
        • S Offline
          sdetweil @Desert Rat
          last edited by Nov 27, 2021, 10:01 PM

          @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
          • E Offline
            evroom @Desert Rat
            last edited by Nov 27, 2021, 10:08 PM

            @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 Nov 29, 2021, 11:21 PM

              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 Nov 29, 2021, 11:26 PM Reply Quote 0
              • S Offline
                sdetweil @Desert Rat
                last edited by Nov 29, 2021, 11:26 PM

                @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 Dec 14, 2021, 3:55 PM Reply Quote 0
                • D Offline
                  Desert Rat @sdetweil
                  last edited by Dec 14, 2021, 3:55 PM

                  @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 Dec 14, 2021, 6:02 PM Reply Quote 0
                  • S Offline
                    sdetweil @Desert Rat
                    last edited by Dec 14, 2021, 6:02 PM

                    @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
                    • 1 / 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