Answers.Body: <p>You can use the <code>--cwd</code> option for <code>cv</code> to set a current working directory:</p>
  
  <p><code>*/5 * * * * /usr/local/bin/cv --cwd=/var/www/html/ api job.execute --user=harrumph</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-17T17:23:51.167Z
Answers.Text: Problem there is, this produces an error   [Symfony\Component\Console\Exception\RuntimeException]
    The "--cwd" option does not exist.
Answers.UserDisplayName: Harrumph
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-20T14:07:57.007Z
Answers.Text: Do you happen to have an older version of cv? The option was added somewhat recently: https://github.com/civicrm/cv/pull/38
Answers.UserDisplayName: Thomas Schüttler
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T08:27:06.313Z
Answers.LastActivityDate: 2018-09-13T08:27:06.313Z
Answers.UserDisplayName: Thomas Schüttler
Answers.Body: <p>Only path, not php-file nor webroot:</p>
  <p>*/5 * * * * cv api job.execute --user=harrumph --cwd=/var/www/html/wordpress/wp-content/uploads/civicrm</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-04T11:35:33.217Z
Answers.LastActivityDate: 2020-08-04T11:35:33.217Z
Answers.UserDisplayName: user8194
Body: <p>I'm trying to get cron to run cv.</p>
  
  <p>Putting this in crontab:</p>
  
  <p>*/5 * * * * /usr/local/bin/cv api job.execute --user=harrumph</p>
  
  <p>produces...</p>
  
  <p>Failed to locate civicrm.settings.php. By default, this tool searches the parent directories for a standard CMS (Drupal, WordPress, etal) and standard civicrm.settings.php. Symlinks and multisite configurations may interfere. To customize, set variable CIVICRM_SETTINGS to point to the preferred civicrm.settings.php.</p>
  
  <p>The correct path to civicrm.settings.php is</p>
  
  <p>/var/www/html/wp-content/uploads/civicrm/civicrm.settings.php</p>
  
  <p>SO...</p>
  
  <p>How am I supposed to use EXPORT in crontab so as to point cv to where it should be looking?</p>
  
Tags: <cron>
Title: What's the right crontab entry for running cv?
ThreadText: # What's the right crontab entry for running cv?
  
  (Asked by: username_0 on 2018-09-12)
  
  I'm trying to get cron to run cv.
  
  Putting this in crontab:
  
  \*/5 \* \* \* \* /usr/local/bin/cv api job.execute --user=harrumph
  
  produces...
  
  Failed to locate civicrm.settings.php. By default, this tool searches the parent directories for a standard CMS (Drupal, WordPress, etal) and standard civicrm.settings.php. Symlinks and multisite configurations may interfere. To customize, set variable CIVICRM\_SETTINGS to point to the preferred civicrm.settings.php.
  
  The correct path to civicrm.settings.php is
  
  /var/www/html/wp-content/uploads/civicrm/civicrm.settings.php
  
  SO...
  
  How am I supposed to use EXPORT in crontab so as to point cv to where it should be looking?
  
  **Tags:** cron
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-09-13. Score: 2
  
  You can use the `--cwd` option for `cv` to set a current working directory:
  
  `*/5 * * * * /usr/local/bin/cv --cwd=/var/www/html/ api job.execute --user=harrumph`
  
  > **Comments:**
  > **username_0**: Problem there is, this produces an error   [Symfony\Component\Console\Exception\RuntimeException]   The "--cwd" option does not exist.  
  > **username_1**: Do you happen to have an older version of cv? The option was added somewhat recently: https://github.com/civicrm/cv/pull/38  
  
  ---
  
  ### Answer by username_2 on 2020-08-04. Score: 0
  
  Only path, not php-file nor webroot:
  
  \*/5 \* \* \* \* cv api job.execute --user=harrumph --cwd=/var/www/html/wordpress/wp-content/uploads/civicrm
  
  
  ---
  
  