Answers.Body: <p>You're not pointing at the <code>craft</code> binary. In your project root directory there should be a file named <code>craft</code>, with no file extension (unless you've renamed it to <code>v1</code>?!). Point to that file and it should work:</p>
  <pre><code>*/5 *   *   *   *   /usr/local/bin/php-head /home/okuhosan/www/v1/craft queue/run
  </code></pre>
  <p>Personally I always set up a daemon instead that just runs <code>listen</code> permanently <a href="https://craftcms.com/docs/5.x/system/queue.html#daemon" rel="nofollow noreferrer">as described in the docs</a> so that you don't have to wait for the cron job to trigger. The docs describe the process for doing that very throughly so I won't repeat it here.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-05-09T16:54:58.143Z
Answers.Text: That's it. When I read the documentation, I thought that /craft would be the root directory and not a file. After changing this, it works perfect. Thank you!
Answers.UserDisplayName: flip
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-05-09T12:52:57.773Z
Answers.LastActivityDate: 2024-05-09T12:52:57.773Z
Answers.UserDisplayName: James Smith
Body: <p>I am Using Craft CMS 5.x and the Formie plugin. Form submissions are entered into the Craft CMS queue. When I enter the control panel, the queue runs and notification mails for form submissions are sent. I want to get notification mails of form submissions automatically without logging into the control panel.</p>
  <p>I have setup a cronjob as described <a href="https://craftcms.com/docs/5.x/system/queue.html#cron" rel="nofollow noreferrer">here</a> but it doesn't work. The cronjob runs without error but the notification mail requests remain in the queue. I contacted my host provider and he told that the setup is generally correct. I also run the job via CLI but nothing happens.</p>
  <p>Here is my cronjob:</p>
  <pre><code>*/5 *   *   *   *   /usr/local/bin/php-head /home/okuhosan/www/v1 queue/run
  </code></pre>
  <p>I use this path to take the latest PHP version which is 8.3 rather than the default version of the host which is 8.1:</p>
  <pre><code>/usr/local/bin/php-head
  </code></pre>
  <p>I have installed Craft CMS in this directory. I am not sure if I have to use another subdirectory, e.g. &quot;web&quot;:</p>
  <pre><code>/home/okuhosan/www/v1
  </code></pre>
  <p>Any ideas?</p>
  <p>P.S. I have also read about this command: queue/listen. Does this mean that I wouldn't need to setup a cronjob but just run it once in CLI and the queue is observed and runs regularly? How do I stop / remove the queue/listen command once setup?</p>
  
Tags: <queue><craft5><plugin-formie>
Title: How to run the queue via CronJob?
ThreadText: # How to run the queue via CronJob?
  
  (Asked by: username_0 on 2024-05-09)
  
  I am Using Craft CMS 5.x and the Formie plugin. Form submissions are entered into the Craft CMS queue. When I enter the control panel, the queue runs and notification mails for form submissions are sent. I want to get notification mails of form submissions automatically without logging into the control panel.
  
  I have setup a cronjob as described [here](https://craftcms.com/docs/5.x/system/queue.html#cron) but it doesn't work. The cronjob runs without error but the notification mail requests remain in the queue. I contacted my host provider and he told that the setup is generally correct. I also run the job via CLI but nothing happens.
  
  Here is my cronjob:
  
  ```
  */5 *   *   *   *   /usr/local/bin/php-head /home/okuhosan/www/v1 queue/run
  
  ```
  
  I use this path to take the latest PHP version which is 8.3 rather than the default version of the host which is 8.1:
  
  ```
  /usr/local/bin/php-head
  
  ```
  
  I have installed Craft CMS in this directory. I am not sure if I have to use another subdirectory, e.g. "web":
  
  ```
  /home/okuhosan/www/v1
  
  ```
  
  Any ideas?
  
  P.S. I have also read about this command: queue/listen. Does this mean that I wouldn't need to setup a cronjob but just run it once in CLI and the queue is observed and runs regularly? How do I stop / remove the queue/listen command once setup?
  
  **Tags:** queue, craft5, plugin-formie
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-05-09. Score: 3 | Accepted answer
  
  You're not pointing at the `craft` binary. In your project root directory there should be a file named `craft`, with no file extension (unless you've renamed it to `v1`?!). Point to that file and it should work:
  
  ```
  */5 *   *   *   *   /usr/local/bin/php-head /home/okuhosan/www/v1/craft queue/run
  
  ```
  
  Personally I always set up a daemon instead that just runs `listen` permanently [as described in the docs](https://craftcms.com/docs/5.x/system/queue.html#daemon) so that you don't have to wait for the cron job to trigger. The docs describe the process for doing that very throughly so I won't repeat it here.
  
  > **Comments:**
  > **username_0**: That's it. When I read the documentation, I thought that /craft would be the root directory and not a file. After changing this, it works perfect. Thank you!  
  
  ---
  
  