Answers.Body: <p>I think it either cannot find <code>wp</code> or it cannot find <code>php</code>. Have you tried specifying the path to <code>wp</code> and setting <code>env</code> as follow:</p>
  <pre><code>/usr/bin/env PATH=&lt;php path&gt;:$PATH &lt;wp path&gt;/wp --user ....
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-17T13:47:55.610Z
Answers.LastActivityDate: 2022-08-17T13:47:55.610Z
Answers.UserDisplayName: masetto
Answers.Body: <p>Maybe a silly question but are you just manually running that from the command line or did you set this up as an actual cron task? Meaning, depending on your hosting setup the control panel might have a section for cron tasks where you would enter the <code>wp</code> command and can configure the timing. Or if there's no control panel, then this is a good article: <a href="https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/" rel="nofollow noreferrer">https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/</a></p>
  <p>Also is &quot;root&quot; an actual wordpress user? The <code>--user</code> option is referring to a wordpress admin user. But that's separate from the timing issue.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-23T17:29:50.443Z
Answers.Text: Thanks for the reply! I forgot to mention I also used crontab -e to add `*/5 * * * * wp --user=root --url=https://www.parlemonde.org --path=/www/parlemonde_330/public civicrm api job.execute auth=0` 
  Indeed root is the admin WP user.
Answers.UserDisplayName: Laurent Arnoult
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-23T01:33:29.120Z
Answers.LastActivityDate: 2021-07-23T01:33:29.120Z
Answers.UserDisplayName: Demerit
Body: <p>I am running civiCRM 5.39.0 on WordPress 5.8
  I am attempting to set up the Cron jobs, using the Cli method. I am running the command from the root folder of the Wordpress install <code>/www/parlemonde_330/public</code></p>
  <p><code>wp --user=root --url=https://www.parlemonde.org --path=/www/parlemonde_330/public civicrm api job.execute auth=0</code></p>
  <p>It does output:</p>
  <pre><code>(
      [is_error] =&gt; 0
      [version] =&gt; 3
      [count] =&gt; 1
      [values] =&gt; 1
  )
  </code></pre>
  <p>And when I check in civiCRM admin panel, all the scheduled jobs are being triggered :-)</p>
  <p>BUT. Then, they do not run on the perodic schedule there are supposed to :-(
  What am I missing? For exemple, Send Scheduled Mailings is set to &quot;Always&quot;... yet, when I'm sending a mass mailing, it stays as &quot;planned&quot;.
  Maybe related to this issue, when I browse the job logs, the &quot;date&quot; column is always empty.
  <a href="https://i.sstatic.net/Zk0rp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Zk0rp.png" alt="enter image description here" /></a></p>
  <p>For the record, running <code>wp option get home</code> triggers <code>https://www.parlemonde.org</code></p>
  
Tags: <cron-job>
Title: Setting up Cron jobs with wp cli
ThreadText: # Setting up Cron jobs with wp cli
  
  (Asked by: username_0 on 2021-07-22)
  
  I am running civiCRM 5.39.0 on WordPress 5.8
  I am attempting to set up the Cron jobs, using the Cli method. I am running the command from the root folder of the Wordpress install /www/parlemonde_330/public
  wp --user=root --url=https://www.parlemonde.org --path=/www/parlemonde_330/public civicrm api job.execute auth=0
  It does output:
  (
      [is_error] => 0
      [version] => 3
      [count] => 1
      [values] => 1
  )
  
  And when I check in civiCRM admin panel, all the scheduled jobs are being triggered :-)
  BUT. Then, they do not run on the perodic schedule there are supposed to :-(
  What am I missing? For exemple, Send Scheduled Mailings is set to "Always"... yet, when I'm sending a mass mailing, it stays as "planned".
  Maybe related to this issue, when I browse the job logs, the "date" column is always empty.
  
  For the record, running wp option get home triggers https://www.parlemonde.org
  
  **Tags:** cron-job
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-08-17. Score: 0
  
  I think it either cannot find wp or it cannot find php. Have you tried specifying the path to wp and setting env as follow:
  /usr/bin/env PATH=:$PATH /wp --user ....
  
  
  ---
  
  ### Answer by username_2 on 2021-07-23. Score: 0
  
  Maybe a silly question but are you just manually running that from the command line or did you set this up as an actual cron task? Meaning, depending on your hosting setup the control panel might have a section for cron tasks where you would enter the `wp` command and can configure the timing. Or if there's no control panel, then this is a good article: <https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/>
  
  Also is "root" an actual wordpress user? The `--user` option is referring to a wordpress admin user. But that's separate from the timing issue.
  
  > **Comments:**
  > **username_0**: Thanks for the reply! I forgot to mention I also used crontab -e to add `*/5 * * * * wp --user=root --url=https://www.parlemonde.org --path=/www/parlemonde_330/public civicrm api job.execute auth=0`  Indeed root is the admin WP user.  
  
  ---
  
  