Manually run send-invoices?

We had some problems with our cron job not firing for invoices that were supposed to go out on the 15th of the month.

Is there a way to manually run the ‘send-invoices’ task?

Also, IF we were to either manually run that task, or if we get the cron working, should a recurring invoice that didn’t get generated/sent on the 15th then be sent now when we get it running?

i.e. does the send-invoices task send any unsent recurring invoices from previous days, or does it just send recurring invoices for the day that it runs?

Even more perplexing … according to server logs, the cron jobs ARE firing:

CMD (/usr/bin/php /var/www/ninja/artisan ninja:send-invoices) CMD (/usr/bin/php /var/www/ninja/artisan ninja:send-reminders)

So the problem appears to be with IN.

We’re still running v2.5.0.4.
Are there any known cron problems with this version?
(I didn’t see anything in the Trello roadmap).

Also, all the Recurring Invoices (that were supposed to go out) show (on the Recurring Invoice view):

Sent Last: March 15, 2016
Send Next: April 15, 2016
Due Next: April 24, 2016

So the data appears to be correct.

ANY help in getting IN to properly be sending recurring invoices would be greatly appreciated as we’ve now got 4+ days of invoices that should have gone out and haven’t.

You can run the command manually using:

php artisan ninja:send-invoices

Maybe the output will provide more info.

Also, you can manually send the invoice by clicking ‘Email Invoice’ on the recurring invoice page.

Thanks for the manual run command syntax.

That helped show the issue.

When I run it manually, I get the following error:

[ErrorException] file_put_contents(/var/www/ninja/storage/framework/services.json): failed t o open stream: Permission denied

This is running it from the same user that the cron job is running as.

The details on that file are this:

-rwxr-xr-x 1 www-data www-data 11691 Dec 18 20:35 services.json

So now my question is, what should the ownership and/or file access of that file be to allow being run by a non-root user (or do I need to add the user to the ‘www-data’ group … if that is possible)?

This may also explain why the cron is failing.

The permissions of the file look correct. From this thread you may be able to fix it by changing the permissions to 777 and then back to 755

chmod -R 777 storage
chmod -R 755 storage

I’ve gotten rid of the initial error, then when trying to run send-reminders, I was getting access violations on the logs directory. I did the same (chmod 777 then chmod 755) and now it seems to all be working properly now.

Hope this helps someone else with similar issues.