Cron Not Working/SMTP Not working

Hi!
I installed Invoice Ninja a few hours ago and I setup the cron with this line(ran by user www-data):
* * * * * cd /var/www/kian/invoiceninja && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

This doesnt seem to work, does anyone have an ideas on what I can do to fix this?

Also my SMTP doesnt seem to be working either. I have set it up on the .env and ran php artisan optimize after. There was no errors, so I sent a password reset request as a test but it hasnt arrived. The SMTP server works fine as I use it on other sites also.

Thanks,
Kian

Hi,

If you have SSH access to the server you can run the command from the CLI to check for any errors.

Have you seen the info here:

https://invoiceninja.github.io/docs/self-host-troubleshooting/#email-not-sending

Hi!
Ive checked on there and my .env looks ok. I sent an email and it still doesnt work. There are no errors in the laravel log, or it just hasnt updated, im not sure. The SMTP server works fine as I just tested it. Is there a way to force the log to update?

Also,
If i run cd /var/www/kian/invoiceninja && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty I dont get any errors in the console but when I go onto InvoiceNinja and click on the Error symbol it says “The Crons need to be enabled” and when I click refresh data it doesnt do anything. Do i need multiple crons or something as the instructions make it sound like you only need one of the crons on there.

I get this If i run another cron command:

@david do you have any thoughts?

So as long as you have

the schedule:run configured in the cron you should be fine.

We used to run a special check every 5 minutes for the cron, but this was having issues on some systems so we moved this to a daily check. (+0 UTC)

I would wait a day or so and then come back to it.

Hi!
If i have: * * * * * cd /var/www/kian/invoiceninja && php artisan schedule:run >> /dev/null 2>&1

Should this work? And is this all i need? Also, does this cron affect when emails are sent, etc?

@kiansniper

The scheduler performs routine tasks: ie Reminders / Recurring Invoices / Updating Currencies.

It is completely separate from the queue system which sends emails. By default we have the queue set to sync - however if you wish to use database queue’s you would also need to configure some way to execute php artisan queue:work

Thanks for this :slight_smile: . Is the cron above correct and should it work?

@kiansniper

It should work, however we see some variability between platforms.

hi!
Just went on the site and no more error. Guess i just had to wait :smiley:. Also, will emails send automatically, etc? or do i need another cron?