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

Help with Crontab starting pm2 mm.sh

Scheduled Pinned Locked Moved Solved Troubleshooting
8 Posts 2 Posters 182 Views 2 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.
  • D Offline
    DDE12
    last edited by Feb 3, 2025, 7:39 PM

    I am using Rasp Pi Bookworm on a Libre Sweet Potato.
    In my user Crontab:
    29 14 * * * pm2 start mm.sh >/dev/null >2&1

    sweetpotatopi:~ $ sudo systemctl status cron
    ● cron.service - Regular background program processing daemon
         Loaded: loaded (/lib/systemd/system/cron.service; enabled; preset: enabled)
         Active: active (running) since Mon 2025-02-03 14:27:37 EST; 1min 55s ago
           Docs: man:cron(8)
       Main PID: 2402 (cron)
          Tasks: 1 (limit: 1986)
         Memory: 368.0K
            CPU: 165ms
         CGroup: /system.slice/cron.service
                 └─2402 /usr/sbin/cron -f
    
    Feb 03 14:27:37 sweetpotatopi systemd[1]: Started cron.service - Regular background program processing daemon.
    Feb 03 14:27:37 sweetpotatopi cron[2402]: (CRON) INFO (pidfile fd = 3)
    Feb 03 14:27:37 sweetpotatopi cron[2402]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
    Feb 03 14:29:01 sweetpotatopi CRON[2409]: pam_unix(cron:session): session opened for user user(uid=1000) by (uid=0)
    Feb 03 14:29:01 sweetpotatopi CRON[2410]: (user) CMD (pm2 start mm.sh >/dev/null >2&1)
    Feb 03 14:29:01 sweetpotatopi CRON[2409]: pam_unix(cron:session): session closed for user user
    
    

    But, the mirror is not starting.

    ~ $ pm2 show mm
     Describing process with id 0 - name mm 
    ┌───────────────────┬────────────────────────────────────┐
    │ status            │ stopped                            │
    │ name              │ mm                                 │
    │ namespace         │ default                            │
    │ version           │ N/A                                │
    │ restarts          │ 0                                  │
    │ uptime            │ 0                                  │
    │ script path       │ /home/user/mm.sh                  │
    │ script args       │ N/A                                │
    │ error log path    │ /home/user/.pm2/logs/mm-error.log │
    │ out log path      │ /home/user/.pm2/logs/mm-out.log   │
    │ pid path          │ /home/user/.pm2/pids/mm-0.pid     │
    │ interpreter       │ bash                               │
    │ interpreter args  │ N/A                                │
    │ script id         │ 0                                  │
    │ exec cwd          │ /home/user                        │
    │ exec mode         │ fork_mode                          │
    │ node.js version   │ N/A                                │
    │ node env          │ N/A                                │
    │ watch & reload    │ ✘                                  │
    │ unstable restarts │ 0                                  │
    │ created at        │ 2025-01-30T12:31:59.717Z           │
    └───────────────────┴────────────────────────────────────┘
     Divergent env variables from local env 
    ┌────────────────┬──────────────────────────────────┐
    │ _LXSESSION_PID │ 1234                             │
    │ SSH_AUTH_SOCK  │ /tmp/ssh-rK5CMznThwsE/agent.1234 │
    │ SSH_AGENT_PID  │ 1326                             │
    └────────────────┴──────────────────────────────────┘
    
    

    What do I have wrong? Thank you for taking a look at this.

    S 1 Reply Last reply Feb 3, 2025, 7:42 PM Reply Quote 0
    • D Offline
      DDE12 @sdetweil
      last edited by Feb 3, 2025, 9:32 PM

      @sdetweil That was the solution. Thank you!

      29 14 * * * /usr/local/bin/pm2 start mm.sh >/dev/null >2&1
      
      S 1 Reply Last reply Feb 3, 2025, 9:40 PM Reply Quote 0
      • S Away
        sdetweil @DDE12
        last edited by Feb 3, 2025, 7:42 PM

        @DDE12 anotgeruser had trouble, turned out he needed the full path to pm2

        which pm2
        

        Should give you that path

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        D 1 Reply Last reply Feb 3, 2025, 9:32 PM Reply Quote 0
        • D Offline
          DDE12 @sdetweil
          last edited by Feb 3, 2025, 9:32 PM

          @sdetweil That was the solution. Thank you!

          29 14 * * * /usr/local/bin/pm2 start mm.sh >/dev/null >2&1
          
          S 1 Reply Last reply Feb 3, 2025, 9:40 PM Reply Quote 0
          • D DDE12 has marked this topic as solved on Feb 3, 2025, 9:32 PM
          • S Away
            sdetweil @DDE12
            last edited by Feb 3, 2025, 9:40 PM

            @DDE12 and you don’t need start mm.sh

            After you’ve done it once

            pm2 status

            Will show the apps

            Name and row number

            You can use name or row number

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • D Offline
              DDE12
              last edited by DDE12 Feb 4, 2025, 1:52 AM Feb 4, 2025, 1:51 AM

              Now I have

              PATH=/usr/local/bin:/usr/bin:/bin
              00 7 * * * pm2 start mm >/dev/null 2>&1
              
              S 1 Reply Last reply Feb 4, 2025, 1:53 AM Reply Quote 0
              • S Away
                sdetweil @DDE12
                last edited by sdetweil Feb 4, 2025, 1:55 AM Feb 4, 2025, 1:53 AM

                @DDE12 awesome!!

                i learned recently that

                &> xxx

                is the same as >xxx 2>&1

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                D 1 Reply Last reply Feb 4, 2025, 2:01 AM Reply Quote 0
                • D Offline
                  DDE12 @sdetweil
                  last edited by Feb 4, 2025, 2:01 AM

                  @sdetweil Like so

                  PATH=/usr/local/bin:/usr/bin:/bin
                  00 7 * * * pm2 start mm &>/dev/null
                  
                  
                  S 1 Reply Last reply Feb 4, 2025, 11:20 AM Reply Quote 0
                  • S Away
                    sdetweil @DDE12
                    last edited by Feb 4, 2025, 11:20 AM

                    @DDE12 yes

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S sdetweil referenced this topic on Feb 18, 2025, 5:19 PM
                    • 1 / 1
                    1 / 1
                    • First post
                      5/8
                      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