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 restart question (more of a linux question than MM)

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    15 Posts 4 Posters 807 Views 4 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 Do not disturb
      sdetweil @wyovino
      last edited by

      @wyovino using the user’s crontab from when the job was defined is the most important

      so

      crontab -e
      (no sudo)

      and then you would look in the /var/logs folder for the syslog file

      and should find a logs entry for the CRON task execution

      Mar  1 07:30:01 sams CRON[2992838]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
      Mar  1 07:30:01 sams CRON[2992839]: (sam) CMD (sshpass -f /home/sam/.idsync sudo rsync ....
      

      it might tell you what is happening to the prior cron jobs. (mine above is rsync just for demonstration)

      pm2 might already have cron support

      Using the --cron-restart Option
      This feature is used to ensure an application, which is intended to run continuously, is refreshed on a regular schedule. 
      Command Line:
      bash
      pm2 start xxxx --cron-restart "0 0 * * *"
      

      pm2 save

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      W 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @wyovino
        last edited by

        @wyovino said:

        I saw the warning post about the April 1st upgrade and Pi Zero W

        no… pi02w is an armv7l processor, pi3 in pi0w physical shape…

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 1
        • W Offline
          wyovino @sdetweil
          last edited by wyovino

          @sdetweil

          Got it!

          In the user crontab:

          30 2 * * * /usr/local/bin/node /usr/local/bin/pm2 restart mm

          Restarts the mirror every day at 2:30 am local time.

          As always, thanks for your quick response!

          Bill

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            JohnGalt @wyovino
            last edited by

            @wyovino

            Bill, I’m glad you found what you were looking for.

            I’m curious - what issue are you addressing by restarting the MagicMirror daily?

            I read this thread with interest because I too have thought about resorting to daily restarts on one of my mirrors. [I’ve figured out that daily restarts won’t meet my needs / fix my problem - so I haven’t gone down that road (yet). I guess I could design a cron schedule that staggers the restart enough that the photo display doesn’t show the same pictures every day, but not yet…]

            W 1 Reply Last reply Reply Quote 0
            • W Offline
              wyovino @JohnGalt
              last edited by

              @JohnGalt My mirror was sometimes stalling - falling to update even the clock.

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                JohnGalt @wyovino
                last edited by

                @wyovino – Ok, good to know.

                One of my magic mirrors stops every few days. There is only one module running on that mirror, MMM-BackgroundSlideshow, so it’s obvious when it happens.

                S 1 Reply Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @JohnGalt
                  last edited by

                  @JohnGalt someone else has reported an out of memory w that module on discord

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    JohnGalt @sdetweil
                    last edited by

                    @sdetweil – Well, I’m not surprised. I have the pictures on a USB drive attached to the raspberry pi, and the more pictures on the drive the worse it gets. It does feel like the software is loading up memory with the pictures.

                    I tried some time ago pulling the pictures from a share on my NAS, (you had advised someone to do that on another thread) but I never got that to work.

                    Thanks for letting us know about the memory issue.

                    S 1 Reply Last reply Reply Quote 0
                    • S Do not disturb
                      sdetweil @JohnGalt
                      last edited by sdetweil

                      @JohnGalt what didn’t work? , glad to help if you want to try agsin

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      J 1 Reply Last reply Reply Quote 0
                      • J Offline
                        JohnGalt @sdetweil
                        last edited by

                        @sdetweil --Hi Sam

                        That was a while ago and my memory is foggy, but the issue was mapping a share on my NAS to the Raspberry Pi on which the MM is running…

                        As best I recall, I tried following directions to map the drive, but it didn’t work. I seem to recall being left with the sense that the process [a] had changed over time due to changes in distributions, and/or [b] that there was something left out of the directions that were likely too obvious to mention for someone who already knew, but was non-obvious to someone out of the know. At that point I gave up.

                        Fast forward to today - I’m happy to invest the time to learn and get it done if you’re willing to help!! I appreciate it. I sent you an email regarding how to best proceed.

                        T 1 Reply Last reply Reply Quote 0
                        • T Offline
                          thartley @JohnGalt
                          last edited by

                          @JohnGalt Hello. I have the same issue not being able to map to a NAS drive using the Terminal commands. I can map to the drive using the Files GUI. I couldn’t get it to work either - the problem seems to between my chair and the keyboard. Even though I got it to map with the FM, I still couldn’t get the MMM_ImagesPhotos module to access the NAS, which in my case is a USB flash drive on my Windows router USB port. I didn’t test to see if the drive letter is persistent between reboots/power failures. -Thanks

                          S J 2 Replies Last reply Reply Quote 0
                          • S Do not disturb
                            sdetweil @thartley
                            last edited by sdetweil

                            @thartley see instructions, next message

                            The trick is MMM-ImagesPhotos uses a fixed folder name, uploads, do you have to create a link from that to your mounted file share

                            Using the ln command

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            S 1 Reply Last reply Reply Quote 0
                            • S Do not disturb
                              sdetweil @sdetweil
                              last edited by sdetweil

                              if your NAS is Synology, like mine
                              create a shared folder using the Control Panel, Shared folder function
                              Screenshot at 2026-04-16 15-47-17.png

                              make sure the permissions are set for whatever user will be accessing it (here sam for me)
                              Screenshot at 2026-04-16 15-47-32.png

                              you should be able to see this share on a Windows or Mac system

                              now you need to enable access from the PI/linux this takes 2 steps

                              1. create a folder of some name in the /media folder,
                                this will require sudo
                                   sudo mkdir /media/xxx 
                              
                              1. create an entry in the /etc/fstab file
                                this will require sudo
                                   sudo nano /etc/fstab 
                              

                              here is mine for the media folder above

                              //192.168.2.32/media /media/xxx cifs username=sam,password=xxxxxxx,iocharset=utf8,file_mode=0777,dir_mode=0777 
                              

                              //NAS_ipaddress/shared_name local_system_folder (from step1),

                              set the username and password required to access this share (as defined in your nas)
                              save the fstab entry ctrl-o, ctrl-x
                              now mount the folder

                              sudo mount -a 
                              

                              then look at the mounted folder

                              ls /media/xxx 
                              

                              (from step 1) you should see the files listed from the shared folder

                              from now on, when the system boots up, it will automount this share.
                              if the nas is down, or something causes lost connection, do

                              sudo mount -a
                              

                              again to reconnect

                              now, for the MMM-ImagesPhotos step
                              it uses a hard coded folder for the images

                               MMM-ImagePhotos/uploads
                              

                              we need to make that point to the mounted folder
                              so,
                              rename the folder out of the way

                              cd ~/MagicMirror/modules/MMM-ImagePhotos
                              mv uploads old_uploads
                              

                              now create a link , need sudo for this , still in the MMM-ImagesPhotos folder

                              sudo ln -s /media/xxx uploads
                              

                              note: if the folder of images you want to display is somewhere other than that root of the server share
                              just add the path to the folder , like this, where folder1 and folder2 are subfolders on the share
                              sudo ln -s /media/xxx/golder1/folder2 uploads

                              then check it

                              ls uploads
                              

                              you should see the same output as in the end of step 2 above

                              now MMM-ImagePhotos will pull images from the mounted and linked share from your nas (file server…)

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                JohnGalt @thartley
                                last edited by

                                @thartley – Follow Sam’s instructions.

                                I am traveling so didn’t get to finish mine. I got to a point where I got a message that the action was in progress, but it would never finish. After some research I’m pretty sure I have a permission problem and will check it out when I get home in a couple of weeks.

                                1 Reply Last reply Reply Quote 0

                                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                With your input, this post could be even better 💗

                                Register Login
                                • 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