Answers.Body: <p>I don't know if there still is a way to use drush but I got the cronjob working with cv:</p>
  <pre><code>composer require civicrm/cv
  </code></pre>
  <p>And then the crontab is:</p>
  <pre><code>* * * * * /var/www/path_to_civi_project/vendor/civicrm/cv/bin/cv api job.execute --user=cronuser --cwd=/var/www/path_to_civi_project/httpdocs
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-20T12:45:47.553Z
Answers.LastActivityDate: 2022-04-20T12:45:47.553Z
Answers.UserDisplayName: Tobias Krause
Body: <p>According to this documentation <a href="https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#drush" rel="nofollow noreferrer">https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#drush</a> I defined the following crontab:</p>
  <pre><code>* * * * * /var/www/path_to_civi_project/vendor/drush/drush/drush -u cronuser -r /var/www/path_to_civi_project/httpdocs -l https://www.public-url.org/ civicrm:api job.execute auth=0 -y
  </code></pre>
  <p>This leads to an error:</p>
  <pre><code>The &quot;-u&quot; option does not exist. 
  </code></pre>
  <p>When I remove this option the Mailings Scheduler fails:</p>
  <pre><code>Finished execution of Mailings scheduler with result: Failure, Error message: API permission check failed for Group/get call; insufficient permission: require access CiviCRM
  </code></pre>
  <p>As the -u option seems to be removed from newer drush versions I wonder how I get the cronjob working. Do I need cv? Can I add cv with composer?</p>
  
Tags: <cron><cron-job><scheduled-job>
Title: Cronjob for CiviCRM with drush 10: The "-u" option does not exist
ThreadText: # Cronjob for CiviCRM with drush 10: The "-u" option does not exist
  
  (Asked by: username_0 on 2022-04-20)
  
  According to this documentation <https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#drush> I defined the following crontab:
  
  ```
  * * * * * /var/www/path_to_civi_project/vendor/drush/drush/drush -u cronuser -r /var/www/path_to_civi_project/httpdocs -l https://www.public-url.org/ civicrm:api job.execute auth=0 -y
  
  ```
  
  This leads to an error:
  
  ```
  The "-u" option does not exist. 
  
  ```
  
  When I remove this option the Mailings Scheduler fails:
  
  ```
  Finished execution of Mailings scheduler with result: Failure, Error message: API permission check failed for Group/get call; insufficient permission: require access CiviCRM
  
  ```
  
  As the -u option seems to be removed from newer drush versions I wonder how I get the cronjob working. Do I need cv? Can I add cv with composer?
  
  **Tags:** cron, cron-job, scheduled-job
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2022-04-20. Score: 3
  
  I don't know if there still is a way to use drush but I got the cronjob working with cv:
  
  ```
  composer require civicrm/cv
  
  ```
  
  And then the crontab is:
  
  ```
  * * * * * /var/www/path_to_civi_project/vendor/civicrm/cv/bin/cv api job.execute --user=cronuser --cwd=/var/www/path_to_civi_project/httpdocs
  
  ```
  
  
  ---
  
  