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

Starting MM Crontab

Scheduled Pinned Locked Moved Bug Hunt
15 Posts 3 Posters 796 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.
  • K Offline
    KristjanESPERANTO Module Developer @mumblebaj
    last edited by KristjanESPERANTO Jul 4, 2025, 6:02 AM Jul 3, 2025, 10:05 PM

    @mumblebaj Just an idea: Maybe the node version used in Cron could be to old. When you run a script manually in your terminal, your full user environment (including things like .bashrc or .zshrc) is loaded. Cron runs in a much more minimal environment — it often doesn’t load your shell config files, so tools like nvm (Node Version Manager) might not be available.

    How to fix it:

    • Use the full path to Node: Find it with which node and use that path in your cron job.
    • Set the environment manually in cron: You can define your PATH at the top of the cron file.
    • Source nvm in your script: If you use nvm, add source ~/.nvm/nvm.sh and nvm use <version> before calling node.
    M 1 Reply Last reply Jul 4, 2025, 1:40 PM Reply Quote 1
    • M Offline
      mumblebaj Module Developer @KristjanESPERANTO
      last edited by Jul 4, 2025, 1:40 PM

      @KristjanESPERANTO Thanks Kristjan. But I don’t see how updating MM could cause this. I only updated MM with Sam’s upgrade script. Don’t see how that has changed anything with regards to how Crontab works. Maybe it is related to changing the launch to node --run start. I can see the command being fired in the log but it does not launch MM like it did before the upgrade.

      Anyhow, I manually launch it for now till I find a suitable solution.

      Check out my modules at: https://github.com/mumblebaj?tab=repositories
      Check my blog-post: https://mumblebaj.xyz/

      S 1 Reply Last reply Jul 4, 2025, 1:46 PM Reply Quote 0
      • S Offline
        sdetweil @mumblebaj
        last edited by Jul 4, 2025, 1:46 PM

        @mumblebaj did you use npm start before?

        it ‘may’ be the path as @KristjanESPERANTO mentioned

        so from the user command line do

        which node

        and use that result in the cron command

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M 2 Replies Last reply Jul 4, 2025, 2:11 PM Reply Quote 0
        • M Offline
          mumblebaj Module Developer @sdetweil
          last edited by Jul 4, 2025, 2:11 PM

          @sdetweil Hi Sam. I have always used npm. I have just been reading through the PR-3764 and i agree with your arguments in that it could have breaking affects for how we do things as both users and devs. Case in point.

          However, the forum is about new things and moving forward, so I agree with @KristjanESPERANTO on that point of view as well.

          I have now resolved my script issue and am now able to launch from the cron again. 😉

          For somebody who may have the same issue, this is how I solved for it.

          export DISPLAY=:0
          cd ~/MagicMirror
          npm run start:x11
          

          The above has solved it for me now.

          Check out my modules at: https://github.com/mumblebaj?tab=repositories
          Check my blog-post: https://mumblebaj.xyz/

          S 1 Reply Last reply Jul 4, 2025, 2:35 PM Reply Quote 2
          • M Offline
            mumblebaj Module Developer @sdetweil
            last edited by Jul 4, 2025, 2:29 PM

            @sdetweil Stupid question, how do I mark this as resolved?

            Check out my modules at: https://github.com/mumblebaj?tab=repositories
            Check my blog-post: https://mumblebaj.xyz/

            S 1 Reply Last reply Jul 4, 2025, 2:32 PM Reply Quote 0
            • S Offline
              sdetweil @mumblebaj
              last edited by Jul 4, 2025, 2:32 PM

              @mumblebaj you didn’t open it as an issue, so it can’t be resolved

              Normally 3 dot menu right of selected post

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @mumblebaj
                last edited by Jul 4, 2025, 2:35 PM

                @mumblebaj what do you think fixed your problem?

                DISPLAY is set in package.json if not already
                folder of course

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                M 1 Reply Last reply Jul 4, 2025, 2:44 PM Reply Quote 0
                • M Offline
                  mumblebaj Module Developer @sdetweil
                  last edited by Jul 4, 2025, 2:44 PM

                  @sdetweil A few things:

                  The main issue being:
                  MagicMirror is now using a flat npm config, and the start scripts are handled differently, node --run start:x11 is not a valid Node.js command — unless you are using a custom wrapper or an internal script, this will fail silently or do nothing.

                  As Crontab runs in a minimal environment, so any graphical (X11) application must explicitly export DISPLAY. Previously I had the command as DISPLAY=:0 npm start. Now, I had to export DISPLAY=:0 first and then start MM.

                  Check out my modules at: https://github.com/mumblebaj?tab=repositories
                  Check my blog-post: https://mumblebaj.xyz/

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