Skip to main content
edited tags
Link
flip
  • 159
  • 6
Source Link
flip
  • 159
  • 6

How to run the queue via CronJob?

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?