Jump to content
  • 0

Cron Not Running Properly When Running Manually


gutterboy

Question

Trying to run the cron manually via the blesta admin, it used to run fine, but now it doesn't seem to. I have two unsent invoices and when I run it it just outputs the following data:

Attempting to run all tasks for Gimko.
All tasks have been completed.
Attempting to run all system tasks.
All system tasks have been completed.

...and the two invoices remain unsent.

 

Does it have some rule about not running too quickly again or something? Why isn't it running?

Link to comment
Share on other sites

Recommended Posts

  • 0

The cron runs as often as it is scheduled. Running it manually observes the same schedule, and will not run tasks that are not ready to be run. If you have unsent invoices that are scheduled to be delivered, they should be sent by cron within the interval you have set under [settings] -> [Company] -> [Automation] -> "Deliver Invoices".

Link to comment
Share on other sites

  • 0

The cron runs as often as it is scheduled. Running it manually observes the same schedule, and will not run tasks that are not ready to be run. If you have unsent invoices that are scheduled to be delivered, they should be sent by cron within the interval you have set under [settings] -> [Company] -> [Automation] -> "Deliver Invoices".

Is there a way to manually run one of the cron steps and force it to run (even out of schedule)?

Link to comment
Share on other sites

  • 0

Thanks Tyson.

 

I noticed at the end of "Deliver Invoices -> Task Last Ran: Aug 20, 2014 11:36:37 PM" I had a loading circle that kept going for some reason?

Yes, that indicates the task is currently running, delivering invoices. If you have a lot queued it could take some time. Or, like Licensecart said, if it failed while it was running, it could have stalled in its running state.

Link to comment
Share on other sites

  • 0

Yes, that indicates the task is currently running, delivering invoices. If you have a lot queued it could take some time. Or, like Licensecart said, if it failed while it was running, it could have stalled in its running state.

 

There was only 2 unsent; so likely it has stalled for some reason. Will an apache reset fix it?

Link to comment
Share on other sites

  • 0

A link should appear on the automation page after some time, which will let you reset the task. After resetting it, you should try running the cron manually. If there is an error, you may see it in the output from running the cron manually. You could also check the php and apache logs for an error, if there was one.

Link to comment
Share on other sites

  • 0

Ok, I just ran it manually again and it is stuck on "Attempting to deliver invoices scheduled for delivery." and when I go to the Automation page I see that loading image again.

 

It has been doing this for about the last 30 minutes now. I did receive an invoice but the status of those invoices show as Unsent.

 

Not seeing any errors output nor in the error logs.

Link to comment
Share on other sites

  • 0

Windows has "scheduled tasks" as opposed to "cron", but the result is the same.

 

You may need to enable error reporting in the config first, otherwise errors may not be shown.

Updated /config/blesta.php and change

Configure::errorReporting(0);

to

Configure::errorReporting(-1);

Then run the cron manually.

Link to comment
Share on other sites

  • 0

That error looks like a normal logged message. The cron task shouldn't have stalled because of that. Did the task finish running? No other errors?

 

Unfortunately that error doesn't tell us much. There is some array index being referenced that doesn't exist, presumably for the second invoice to be delivered. Not sure why that would be.

 

I wonder if you will have the same problem when downloading multiple invoices. The print queue does almost the same thing as that cron task. You can edit the two invoices and set to deliver them via Paper. Then, head over to [billing] -> [Print Queue] and click to Print the selected invoices. This will prompt you to download a PDF containing the invoices so that you can print them manually. If that is successful, then I'm not sure what the problem could be.

Link to comment
Share on other sites

  • 0

I will try that out...... but I think this problem actually may have been caused by a customization we had done to the creating of invoices perhaps; though that was via the API only, so not sure why it would affect anything else.

 

I have PM'ed the developer that did it for us and will update when I know more.

Link to comment
Share on other sites

  • 0

Ok, it seems I was right. Problem was caused by incorrect creation of the invoices. The plugin / customization we had done makes it so we can only create invoices via the API as creating them via the admin doesn't supply them with all the info needed. I have run a number of tests runs via the API and all seems fine now.

Link to comment
Share on other sites

  • 0

Hmmmmm........ been doing some more testing now. Only adding new invoices via the API but it still seeems to stall a lot of the time.

 

I had 3 invoices due for delivery and it only delivered one of them and then continue with the other tasks (but the loading icon was still showing for that task in admin).

 

I ran it a few mins later to attempt to deliver the other two invoices, it delivered both of them but stalled and didn't continue onto the other tasks (and is showing the loading icon again).

 

So not really sure if this is Blesta itself or something to do with our customizations done.

 

Nothing in the error logs about it.

 

Do you think this has anything to do with PHP's "max_execution_time"?

Link to comment
Share on other sites

  • 0

Hmmmmm........ been doing some more testing now. Only adding new invoices via the API but it still seeems to stall a lot of the time.

 

I had 3 invoices due for delivery and it only delivered one of them and then continue with the other tasks (but the loading icon was still showing for that task in admin).

 

I ran it a few mins later to attempt to deliver the other two invoices, it delivered both of them but stalled and didn't continue onto the other tasks (and is showing the loading icon again).

 

So not really sure if this is Blesta itself or something to do with our customizations done.

 

Nothing in the error logs about it.

 

Do you think this has anything to do with PHP's "max_execution_time"?

 

Probably, as that will terminate Blesta if it takes longer than ... such... such.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...