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
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.
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.
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.
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.
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).
I’m still struggling with the cron job and scheduled events in Invoice Ninja v5. Most recently, after upgrading to the lastest version, I am now receiving the following output from the cron job, even though scheduled events (eg. sending out invoice reminders) are still not working:
[2021-11-05T15:30:09+00:00] Running scheduled command: Callback
Does this offer any more insight what might be happening so I can fix this problem?
This command is what helps us determine whether your crons are configured and are executing correctly. It sounds like the cron is definitely working, however something else in the hosting stack is preventing the actual command from running.
I’m not sure I can offer more help that this other than to note that I have my own cPanel shared hosting account and cannot recreate this issue, so it may be something specific to your webhosts server configuration
In your very first post you wrote you set the cron job to run every three minutes. AFAIK it really needs to run every minute. So, if your cron job says something like
I have been corresponding with my server tech support & attempting to determine what might differ in my cPanel installation. All of the listed IN software requirements are met (Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja). & I am using PHP 7.4… yet scheduled invoices/emails are not being sent.
Is there a working installation I/tech support could somehow compare the software running in my server with to see what might differ? Or any other way to narrow this problem down? If an IN admin would like to check my IN backend settings, I can provide a login.
If the system still does not send emails, then your webhost has disabled the required functions to execute schedule:run which is what the crons are attempting to run also