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.

    Cronjob doesn't work with my MM

    Scheduled Pinned Locked Moved Troubleshooting
    16 Posts 7 Posters 2.8k Views 7 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.
    • M Offline
      MisterT
      last edited by

      ok so with pm2 flush and this crontab

      52 12 * * *   pi     pm2 stop MagicMirror >/dev/null 2>&1
      54 12 * * *   pi     pm2 start MagicMirror
      
      

      the pm2 logs :
      pm2 errors

      [12:51:04.343] [ERROR]  ERROR! Could not find main module js file for MMM-GooglemapsTraffic.original
      ATTENTION: default value of option force_s3tc_enable overridden by environment.
      [12:51:08.418] [ERROR]  ERROR! Could not find main module js file for MagicMirror-Display-Controller
      [12:51:09.801] [ERROR]  ERROR! Could not find main module js file for fabio
      [12:51:21.774] [ERROR]  (node:25245) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
      [12:51:35.140] [ERROR]  Error: status code: 401
          at /home/pi/MagicMirror/modules/MMM-FreeBox-Monitor/node_modules/omdb/index.js:211:25
          at done (/home/pi/MagicMirror/modules/MMM-FreeBox-Monitor/node_modules/needle/lib/needle.js:432:14)
          at PassThrough.<anonymous> (/home/pi/MagicMirror/modules/MMM-FreeBox-Monitor/node_modules/needle/lib/needle.js:671:11)
          at PassThrough.emit (events.js:182:13)
          at endReadableNT (_stream_readable.js:1090:12)
          at process._tickCallback (internal/process/next_tick.js:63:19)
      

      pm2 out

      
      > magicmirror@2.10.1 start /home/pi/MagicMirror
      > ./run-start.sh
      
      [12:50:32.600] [LOG]    Starting MagicMirror: v2.10.1
      [12:50:32.632] [LOG]    Loading config ...
      [12:50:32.668] [LOG]    Loading module helpers ...
      [12:50:32.670] [LOG]    No helper found for module: alert.
      [12:50:32.820] [LOG]    Initializing new module helper ...
      [12:50:32.826] [LOG]    Module helper loaded: updatenotification
      [12:50:32.829] [LOG]    No helper found for module: clock.
      [12:50:34.340] [LOG]    Initializing new module helper ...
      [12:50:34.341] [LOG]    Module helper loaded: calendar
      [12:50:34.343] [LOG]    No helper found for module: weatherforecast.
      [12:50:34.471] [LOG]    Initializing new module helper ...
      [12:50:34.472] [LOG]    Module helper loaded: newsfeed
      [12:50:34.483] [LOG]    No helper found for module: MMM-Globe.
      [12:50:35.854] [LOG]    Initializing new module helper ...
      [12:50:35.856] [LOG]    Module helper loaded: MMM-MovieListings
      [12:50:35.862] [LOG]    No helper found for module: MMM-Scrobbler.
      [12:50:37.296] [LOG]    Initializing new module helper ...
      [12:50:37.297] [LOG]    Module helper loaded: MMM-soccer
      [12:50:44.499] [LOG]    Initializing new module helper ...
      [12:50:44.501] [LOG]    Module helper loaded: MMM-News
      [12:50:44.521] [LOG]    Initializing new module helper ...
      [12:50:44.528] [LOG]    Module helper loaded: WallberryTheme
      [12:50:44.532] [LOG]    No helper found for module: WB-clock.
      [12:50:44.541] [LOG]    Initializing new module helper ...
      [12:50:44.543] [LOG]    Module helper loaded: WB-weather
      [12:50:44.578] [LOG]    Initializing new module helper ...
      [12:50:44.580] [LOG]    Module helper loaded: MMM-GroveGestures
      [12:50:45.966] [LOG]    Initializing new module helper ...
      [12:50:45.967] [LOG]    Module helper loaded: MMM-AQI
      [12:50:48.096] [LOG]    Initializing new module helper ...
      [12:50:48.099] [LOG]    Check MagicMirror version for node helper 'MMM-Strava' - Minimum version:  2.2.0 - Current version: 2.10.1
      [12:50:48.101] [LOG]    Version is ok!
      [12:50:48.102] [LOG]    Module helper loaded: MMM-Strava
      [12:50:48.834] [LOG]    Initializing new module helper ...
      [12:50:48.836] [LOG]    Module helper loaded: MMM-GooglePhotos
      [12:50:51.424] [LOG]    Initializing new module helper ...
      [12:50:51.426] [LOG]    Module helper loaded: MMM-FreeBox-Monitor
      [12:50:51.428] [LOG]    No helper found for module: currentweather.
      [12:50:51.434] [LOG]    No helper found for module: domoticz.
      [12:50:51.692] [LOG]    Initializing new module helper ...
      [12:50:51.694] [LOG]    Module helper loaded: MMM-ModuleScheduler
      [12:50:51.935] [LOG]    Initializing new module helper ...
      [12:50:51.936] [LOG]    Module helper loaded: MMM-Remote-Control
      [12:50:53.520] [LOG]    Initializing new module helper ...
      [12:50:53.522] [LOG]    Module helper loaded: MMM-NowPlayingOnSpotify
      [12:50:54.681] [LOG]    Initializing new module helper ...
      [12:50:54.687] [LOG]    Module helper loaded: MMM-COVID19-SPARKLINE
      [12:50:55.499] [LOG]    Initializing new module helper ...
      [12:50:55.500] [LOG]    Module helper loaded: MMM-Hotword
      [12:51:01.172] [LOG]    Initializing new module helper ...
      [12:51:01.173] [LOG]    Module helper loaded: MMM-AssistantMk2
      [12:51:01.176] [LOG]    No helper found for module: MMM-pages.
      [12:51:01.180] [LOG]    No helper found for module: MMM-page-indicator.
      [12:51:01.182] [LOG]    All module helpers loaded.
      [12:51:01.187] [LOG]    Starting server on port 8080 ... 
      [12:51:01.197] [INFO]   You're using a full whitelist configuration to allow for all IPs
      [12:51:01.210] [LOG]    Server started ...
      [12:51:01.215] [LOG]    Connecting socket for: updatenotification
      [12:51:01.219] [LOG]    Connecting socket for: calendar
      [12:51:01.222] [LOG]    Starting node helper for: calendar
      [12:51:01.225] [LOG]    Connecting socket for: newsfeed
      [12:51:01.228] [LOG]    Starting module: newsfeed
      [12:51:01.230] [LOG]    Connecting socket for: MMM-MovieListings
      [12:51:01.231] [LOG]    MMM-MovieListing helper started...
      [12:51:01.233] [LOG]    Connecting socket for: MMM-soccer
      [12:51:01.234] [LOG]    Starting module: MMM-soccer
      [12:51:01.235] [LOG]    Connecting socket for: MMM-News
      [12:51:01.237] [LOG]    Connecting socket for: WallberryTheme
      [12:51:01.238] [LOG]    Starting module helper: WallberryTheme
      [12:51:01.239] [LOG]    Connecting socket for: WB-weather
      [12:51:01.242] [LOG]    Connecting socket for: MMM-GroveGestures
      [12:51:01.245] [LOG]    Connecting socket for: MMM-AQI
      [12:51:01.247] [LOG]    MMM-AQI helper started ...
      [12:51:01.250] [LOG]    Connecting socket for: MMM-Strava
      [12:51:01.253] [LOG]    Starting module helper: MMM-Strava
      [12:51:01.258] [LOG]    Connecting socket for: MMM-GooglePhotos
      [12:51:01.261] [LOG]    Connecting socket for: MMM-FreeBox-Monitor
      [12:51:01.265] [LOG]    Starting module: MMM-FreeBox-Monitor
      [12:51:01.266] [LOG]    Connecting socket for: MMM-ModuleScheduler
      [12:51:01.267] [LOG]    Starting node helper for: MMM-ModuleScheduler
      [12:51:01.269] [LOG]    Connecting socket for: MMM-Remote-Control
      [12:51:01.270] [LOG]    Starting node helper for: MMM-Remote-Control
      [12:51:01.293] [LOG]    Connecting socket for: MMM-NowPlayingOnSpotify
      [12:51:01.296] [LOG]    Connecting socket for: MMM-COVID19-SPARKLINE
      [12:51:01.297] [LOG]    Starting node helper for: MMM-COVID19-SPARKLINE
      [12:51:01.298] [LOG]    Connecting socket for: MMM-Hotword
      [12:51:01.299] [LOG]    [HOTWORD] MMM-Hotword starts
      [12:51:01.301] [LOG]    Connecting socket for: MMM-AssistantMk2
      [12:51:01.302] [LOG]    Sockets connected & modules started ...
      [12:51:02.126] [LOG]    Launching application.
      [12:51:20.629] [LOG]    Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/lxxxxxxx/basic.ics - Interval: 300000
      [12:51:20.672] [LOG]    Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/xxxxxx/basic.ics - Interval: 300000
      [12:51:20.866] [LOG]    Create new news fetcher for url: https://www.francetvinfo.fr/titres.rss - Interval: 300000
      [12:51:21.153] [LOG]    Get league table for url http://api.football-data.org/v2/competitions/FL1/standings
      [12:51:21.209] [LOG]    [NEWS] Initialized.
      [12:51:21.298] [LOG]    FREEBOX: "CONNECT" [object Object]
      [12:51:21.308] [LOG]    { track_id: 0,
        app_token:
         'rxxxxxxx,
        appId: 'fr.freebox',
        challenge: 'xxxxxxxxxxx',
        session_token:
         'xa5r1W+kxfU+tnnR9U/10YzBJ1/xxxxxxxx }
      [12:51:21.355] [LOG]    MMM-ModuleScheduler is removing all scheduled jobs
      [12:51:21.356] [LOG]    MMM-ModuleScheduler received CREATE_NOTIFICATION_SCHEDULE
      [12:51:21.360] [LOG]    MMM-ModuleScheduler is scheduling SHOW_ALERT using "35 11 * * *
      [12:51:21.445] [LOG]    MMM-ModuleScheduler has scheduled SHOW_ALERT
      [12:51:21.461] [LOG]    MMM-ModuleScheduler will next send SHOW_ALERT at Mon May 18 2020 11:35:00 GMT+0200 (CEST)
      [12:51:21.463] [LOG]    MMM-ModuleScheduler is scheduling SHOW_ALERT using "13 15 * * *
      [12:51:21.477] [LOG]    MMM-ModuleScheduler has scheduled SHOW_ALERT
      [12:51:21.485] [LOG]    MMM-ModuleScheduler will next send SHOW_ALERT at Sun May 17 2020 15:13:00 GMT+0200 (CEST)
      [12:51:21.486] [LOG]    MMM-ModuleScheduler is scheduling REMOTE_ACTION using "55 11 * * *
      [12:51:21.502] [LOG]    MMM-ModuleScheduler has scheduled REMOTE_ACTION
      [12:51:21.540] [LOG]    MMM-ModuleScheduler will next send REMOTE_ACTION at Mon May 18 2020 11:55:00 GMT+0200 (CEST)
      [12:51:21.544] [LOG]    MMM-ModuleScheduler is scheduling REMOTE_ACTION using "00 08 * * *
      [12:51:21.556] [LOG]    MMM-ModuleScheduler has scheduled REMOTE_ACTION
      [12:51:21.570] [LOG]    MMM-ModuleScheduler will next send REMOTE_ACTION at Mon May 18 2020 08:00:00 GMT+0200 (CEST)
      [12:51:21.573] [LOG]    MMM-ModuleScheduler is scheduling REMOTE_ACTION using "00 19 * * *
      [12:51:21.583] [LOG]    MMM-ModuleScheduler has scheduled REMOTE_ACTION
      [12:51:21.587] [LOG]    MMM-ModuleScheduler will next send REMOTE_ACTION at Sun May 17 2020 19:00:00 GMT+0200 (CEST)
      [12:51:21.642] [LOG]    [COVID:CORE] Scan starts.
      [12:51:21.739] [LOG]    [HOTWORD] Recipe is loaded: with-AMk2v3_Jarvis.js
      [12:51:22.200] [LOG]    CallbackGetChallenge -> [object Object]
      [12:51:22.722] [LOG]    Electron's cache successfully cleared.
      [12:51:23.375] [LOG]    Refreshed access token because it has expired. Expired at: 12:51:21 now is: 12:51:23
      [12:51:25.260] [LOG]    [NEWS] Articles are aggregated :  45
      [12:51:25.784] [LOG]    [HOTWORD] begins.
      [12:51:25.788] [LOG]    [HOTWORD] Detector starts listening.
      [12:51:26.050] [LOG]    [COVID:CORE] Access to data source.
      [12:51:27.283] [LOG]    [COVID:CORE] Resolving: csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv
      [12:51:27.963] [LOG]    [COVID:CORE] Resolving: csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv
      [12:51:30.338] [LOG]    [COVID:CORE] Resolving: csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv
      [12:51:30.422] [LOG]    can't find property recovered Canada:
      [12:51:30.423] [LOG]    adding...
      [12:51:30.677] [LOG]    [COVID:CORE] Calculating Wordlwide total.
      [12:51:30.888] [LOG]    [COVID:CORE] Scan Completed.
      [12:51:33.466] [LOG]    [AMK2] MMM-AssistantMk2 Version: 3.3.0
      [12:51:33.478] [LOG]    [AMK2] Response delay is set to 0.5 second
      [12:51:33.481] [LOG]    [AMK2] Use HTML5 for audio response
      [12:51:33.496] [LOG]    [AMK2] RECIPE_LOADED: with-MMM-Hotword.js
      [12:51:33.498] [LOG]    [AMK2] NO_ACTION_TO_MANAGE
      [12:51:33.521] [LOG]    [AMK2] ASSISTANT_WEB Started
      [12:51:33.538] [LOG]    [AMK2] AssistantMk2 is initialized.
      [12:51:33.906] [LOG]    FREEBOX: "GET_CALLS" [object Object]
      [12:51:33.960] [LOG]    FREEBOX: "GET_DOWNLOADS" [object Object]
      [12:51:34.090] [LOG]    FREEBOX: "GET_CONNECTIONSTATUS" [object Object]
      [12:55:40.854] [LOG]    Shutting down server...
      [12:55:40.865] [LOG]    Stopping module helper: updatenotification
      [12:55:40.876] [LOG]    Stopping module helper: calendar
      [12:55:40.882] [LOG]    Stopping module helper: newsfeed
      [12:55:40.884] [LOG]    Stopping module helper: MMM-MovieListings
      [12:55:40.886] [LOG]    Stopping module helper: MMM-soccer
      [12:55:40.891] [LOG]    Stopping module helper: MMM-News
      [12:55:40.897] [LOG]    Stopping module helper: WallberryTheme
      [12:55:40.903] [LOG]    Stopping module helper: WB-weather
      [12:55:40.914] [LOG]    Stopping module helper: MMM-AQI
      [12:55:40.916] [LOG]    Stopping module helper: MMM-Strava
      [12:55:40.918] [LOG]    Stopping module helper: MMM-GooglePhotos
      [12:55:40.920] [LOG]    Stopping module helper: MMM-FreeBox-Monitor
      [12:55:40.921] [LOG]    Stopping module helper: MMM-ModuleScheduler
      [12:55:40.932] [LOG]    Stopping module helper: MMM-NowPlayingOnSpotify
      [12:55:40.936] [LOG]    Stopping module helper: MMM-COVID19-SPARKLINE
      [12:55:40.941] [LOG]    Stopping module helper: MMM-Hotword
      [12:55:40.946] [LOG]    Stopping module helper: MMM-AssistantMk2
      
      

      and cron log

      May 17 12:49:33 raspberrypi crontab[25141]: (pi) BEGIN EDIT (pi)
      May 17 12:50:12 raspberrypi crontab[25141]: (pi) REPLACE (pi)
      May 17 12:50:12 raspberrypi crontab[25141]: (pi) END EDIT (pi)
      May 17 12:51:01 raspberrypi cron[410]: (pi) RELOAD (crontabs/pi)
      May 17 12:52:01 raspberrypi CRON[25574]: (pi) CMD (pi     pm2 stop MagicMirror >/dev/null 2>&1)
      May 17 12:54:01 raspberrypi CRON[25592]: (pi) CMD (pi     pm2 start MagicMirror)
      May 17 12:54:01 raspberrypi CRON[25582]: (CRON) info (No MTA installed, discarding output)
      

      Do you see something wrong ?

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

        @MisterT said in Cronjob doesn't work with my MM:

        [12:51:04.343] [ERROR] ERROR! Could not find main module js file for MMM-GooglemapsTraffic.original
        ATTENTION: default value of option force_s3tc_enable overridden by environment.
        [12:51:08.418] [ERROR] ERROR! Could not find main module js file for MagicMirror-Display-Controller
        [12:51:09.801] [ERROR] ERROR! Could not find main module js file for fabio

        you should add

        disabled: true,
        

        to those three modules in you config.js
        right after the module name

        the times don’t line up on the reports…
        cron log

        May 17 12:52:01 raspberrypi CRON[25574]: (pi) CMD (pi     pm2 stop MagicMirror >/dev/null 2>&1)
        

        pm2 log

        [12:55:40.854] [LOG]    Shutting down server...
        

        take this off the shutdown command
        pm2 stop MagicMirror >/dev/null 2>&1
        add a couple commands to the cron right in front of the shutdown

        pm2 info 0
        pm2 status 0
        

        these should output to the cron log

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • C Offline
          chassain 0 @MisterT
          last edited by

          @MisterT

          PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
          SHELL=/bin/bash

          0 20 * * * pm2 stop mm
          0 6 * * 1-5 pm2 start mm

          1 Reply Last reply Reply Quote 0
          • M Offline
            MisterT
            last edited by

            @chassain-0 i tried your solution but still not work, same with pm2 stop/start MagicMirror

            @sdetweil with this cron

            44 18 * * * pi pm2 start MagicMirror > pm2 status 0
            or
            46 18 * * * pi pm2 start MagicMirror > pm2 info 0

            i had a log in pi folder at the same time but a blank log

            I tested my cron with a simple Hello word .py and cronjob works.

            have you an other solution ?

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

              @MisterT pm2 is a big node application, so if needs to be in the right folder and process

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • T Offline
                Tribun
                last edited by

                Hello MisterT
                I’m not an expert, I’m more of a beginner, but I tried to use a cronjob to stop and start the mirror on my mirror.

                10 23 * * * pm2 stop mm> / dev / null 2> & 1
                15 23 * * * pm2 start mm> / dev / null 2> & 1
                it worked for me.
                I use the MagicMirror² v2.11.0 and NAME = “Raspbian GNU / Linux”
                VERSION_ID = “10”
                VERSION = “10 (buster)”
                VERSION_CODENAME = buster.
                With older versions of the software I always had problems starting MagicMirror because of access violations with pm2 after a reboot.
                Maybe this will help you solve your problem.

                1 Reply Last reply Reply Quote 0
                • bheplerB Offline
                  bhepler Module Developer
                  last edited by

                  Allow me to deliver a gentle reminder to use the markdown features of the forum when posting code and logs.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MisterT
                    last edited by

                    Hi it’s me again
                    So i made a fresh installation of raspbian buster and latest version of Magic mirror. I used the auto install from @sdetweil . At the end of autoinstall, a message appears and says: Do you want use pm2 to autostart your mirror?
                    So i pressed yes.
                    After this i restart my Magic mirror but it didn’t start with raspbian.

                    I try my cronjob in crontab-e but nothing happen

                    SHELL=/bin/sh
                    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
                    01 00 * * *   pi      pm2 restart MagicMirror
                    00 08 * * *   pi      pm2 restart MagicMirror
                    10 16 * * *   pi      pm2 stop MagicMirror
                    
                    

                    does this command line can resolve my problem from @sdetweil git script?

                    bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/fixuppm2.sh)"
                    

                    Thx for next answers

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

                      @MisterT i have seen this a couple times… not sure why,

                      run the fixuppm2.sh script from my repo and see if that fixes the problem

                      one line to copy/paste

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      M 1 Reply Last reply Reply Quote 0
                      • M Offline
                        MisterT @sdetweil
                        last edited by

                        @sdetweil i apply your command line and magic mirror starts with raspbian. I’ll come back if i have problems with my crontab
                        Thx

                        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