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

CC BY-SA 4.0
2024-05-09T16:54:58.143Z
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!
flip
CC BY-SA 4.0
2024-05-09T12:52:57.773Z
2024-05-09T12:52:57.773Z
James Smith
<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>

<queue><craft5><plugin-formie>
How to run the queue via CronJob?
# 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 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 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!  

---

