Setting up appropriate Cron job(s) on shared hosting for v5

I’m self-hosting v5 but installed via Softaculous on my hosting provider. I had the little red triangle in the bottom-left corner showing up telling me to fix my cron job configuration. I went into the Cron job config and forced a rerun as apparently the Softaculous installation creates these automatically, and the little red triangle went away. However, I found a reference in the docs about adding the following Cron job config to increase app performance:

/home/me/invoice.me.com && /opt/alt/php81/usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

I likewise, as a result of the Softaculous install, have the following two Cron jobs:

cd /home/me/invoice.me.com && /opt/alt/php81/usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

php /home/me/public_html/artisan ninja:send-invoices

My question is, do I need all three of these or are they all doing essentially the same thing? Can I just use the first one I posted above?

Note: All of these Cron jobs are set to run every 5 minutes.

Hi,

I believe ninja:send-invoices is only needed for v4.

The ‘queue:work’ command is needed if you enable the queue in the .env file by setting it to a value other than sync. The benefit of the queue is it allows the server to wait to do longer tasks (ie. send emails) rathe than make the user wait in the app for it to be sent.

1 Like

Ok. Thanks. I can remove ninja:send-invoices then since I’m using V5, and I’ll go into .env and change it from sync to `queue=database’

Is database here just a generic term where I need to put the name of my database, or do I need to literally just put database

You just need to set it to database

1 Like

Hello!
This affects me also.
I followed your steps and changed sync to database, but still have the triangle.
How do you go in the Cron job config and force a rerun?
Thanks.

I have the following cron job:

cd /home/user/mysite.com && /opt/cpanel/ea-php81/root/usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

Do I need the above:
/home/me/invoice.me.com && /opt/alt/php81/usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

Thanks

Hi,

I suggest running the cron from CLI without the >> part and checking the output

Thanks for the reply!

Hopefully I did it right. It printed the following:

cd /home/me/ninja.com && /opt/cpanel/ea-php81/root/usr/bin/php -d register_argc_argv=On artisan schedule:run /dev/null 2>&1

No arguments expected for “schedule:run” command, got “/dev/null”.

You need to remove everything after >>

cd /home/me/ninja.com && /opt/cpanel/ea-php81/root/usr/bin/php -d register_argc_argv=On artisan schedule:run