"The crons need to be enabled" error - cPanel setup

I have been using crons successfully on v4 with the following style code in cPanel:
/usr/local/bin/php /home/seamless/public_html/clients/artisan ninja:send-reminders

Sadly when I use the following code (set to run every three minutes for troubleshooting purposes), I receive the red triangle error in the bottom left of the v5 dashboard “the crons need to be enabled.”
cd /home/seamless/public_html/clientsnew && /usr/local/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

I have tried a single “>” instead of “>>”, and a closing “/” after clientsnew, but the error persists.

I am waiting till this is resolved before importing data from v4.

If it’s useful, my cPanel gives the following as example code to run:
/usr/local/bin/php /home/seamless/public_html/path/to/cron/script

Is there any alternate configuration I can try?

@david do you have any suggestions?

this works on my cPanel

cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

Note the scheduled task which checks whether the crons work is executed daily, so you may h ave a valid config, but it may take a day to check and update.

Thank you so very much for the input.

I also emailed my server support staff & they executed the command manually & without “>> /dev/null 2>&1” in order to see the output. The output was “No scheduled commands are ready to run” which gives the appearance that the command is executing correctly (right?)

So maybe the cron job is working. The only indicator I am going on is the red triangle in v5 indicating the error “the crons need to be enabled.”

Could it be that the red triangle is reporting incorrectly? As of now, I don’t have any content imported into v5, so I guess it has nothing to process. It’s just a bare installation with my username/password.

Thanks!

The only suggestion I have is to try to be explicit about php7.4, rather than just calling ‘php’ in your command, which is an alias for your default php version. This only really applies if your platform is running multiple versions of PHP or PHP-FPM, it’s a workaround. Other users have noticed it taking a while for the red ! alert to go away too.

Just a quick update to see if anyone can assist:

I now have a recurring invoice in v5. Next send date is Aug 2 & it has been “started.” (so there should be something for the cron to process).

When I execute the following command:

cd /home/seamless/public_html/clientsnew && /usr/local/bin/php -d register_argc_argv=On artisan schedule:run

I receive the output: “No scheduled commands are ready to run.”

Does this indicate a problem elsewhere than the cron? (& yes, the red triangle “the crons need to be enabled” is still lit up…)

Thanks!

I still seem to have problems with the “the crons need to be enabled” error.

Every time the cron job ticks over, I receive the output “No scheduled commands are ready to run.”

The red triangle on the bottom left of the back end continues to appear.

Is there any way to troubleshoot this, or to find a workaround?

@madumi,

are you using recurring invoices at all? are your scheduled tasks running? ie recurring invoices sending etc etc?

@david
Thanks for your message–sorry for the delay getting back to you.

Yes, I have for example a recurring invoices whose next send date is Sept 18,
and I have a non-recurring invoice whose next send date is Aug. 28

The recurring invoice is not being generated, and the non-recurring invoice doesn’t have reminders being sent out.

Each time the cron executes, I receive the output “No scheduled commands are ready to run.”

I am happy to try anything to troubleshoot or solve, I just need some direction what I might do.

It is good to note that manually running the command gives you the correct response. This indicates that the way you have configured the cron to run may need some adjustments as when the cron attempts it, it may be using a wrong path to either the PHP binary or the path to the artisan command.

@david
Thank you so much for your reply.

Even if I manually execute the code:

cd /home/seamless/public_html/clientsnew && /opt/alt/php73/usr/bin/php -d register_argc_argv=On artisan schedule:run

I also receive the output “No scheduled commands are ready to run”

Is there a way to troubleshoot what is going wrong?

V5 Cron Setup Guide - Debian 10.x Self-host - CLI Access req’d - Self-Hosted | v5 - Discourse (invoiceninja.com)
If you look at this user’s nice little guide under the header Cron Output Logs he shows an example of how to change the cron job ending so instead of piping to null, it appends the results to a log file, which can help you see the results of the cron job itself, so you can better tell if it is running.

I have personally had most luck putting the command directly into the /etc/crontab file, which requires you to specify the user:
* * * * * www-data /usr/bin/php7.4 /path/to/invoice/ninja/artisan schedule:run >> /dev/null 2>&1

@TechnicallyComputers
Thanks for your suggestion. Yes, I already am using a version of the command that lacks the >> /dev/null 2>&1 – so I am receiving the output from the command.

Each time the command runs, whether by cron, or from the command line, it gives the output “No scheduled commands are ready to run,” which is great, except that there are invoices & emails that need to go out, and are failing to go out (recurring invoices & invoice reminders).