Cron Config. Setup Issue... Help?

I was trying to add the crontab configs for the schedule… Having an issue on the command.(see below)

I added this below to the crontab:

#InvoiceNinja
0 8 * * * /usr/bin/php7.4 /var/www/invoice-ninja/artisan ninja:send-invoices > /dev/null
0 8 * * * /usr/bin/php7.4 /var/www/invoice-ninja/artisan ninja:send-reminders > /dev/null

and saved but when trying to run the command:
sudo /usr/bin/php7.4 /var/www/invoice-ninja/artisan ninja:send-invoices

I am getting this:

Command “ninja:send-invoices” is not defined.

Did you mean one of these?
ninja:backup-update
ninja:check-data
ninja:check-db
ninja:create-account
ninja:create-single-account
ninja:create-test-data
ninja:demo-mode
ninja:design-update
ninja:import
ninja:mobile-localization
ninja:old-import
ninja:pcheck-data
ninja:post-update
ninja:react
ninja:s3-cleanup
ninja:send-recurring
ninja:send-reminders
ninja:send-test-emails
ninja:subdomain
ninja:sync-users
ninja:translations
ninja:type-check

Hi,

Those are the crons for v4, there’s info about v5 here:

https://invoiceninja.github.io/docs/self-host-installation/#cron-configuration

Thank you! when it saids path to my project…

          • cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Would this be this path? or the root of the installation?
/usr/bin/php7.4 /var/www/invoice-ninja/artisan

@P1NYC

You’ll want to write is like this

* * * * * cd /path/to/root/of/installation/ ^^ /usr/bin/php7.4 artisan schedule:run >> /dev/null 2>&1

Thank you sir! :slight_smile:

1 Like

@David Is there a reason why your documentation has it to cd into the directory vs doing something like this:

* * * * * /usr/bin/php /path/to/ninja-root artisan schedule:run >> /dev/null 2>&1

@maverick

I believe the Laravel documentation defines the crons like this for the scheduler. But certainly it doesn’t have to be defined that way.