Jump to content
  • 0

Cron Not Running Properly When Running Manually


Question

Posted

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?

Recommended Posts

  • 0
Posted

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".

  • 0
Posted

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)?

  • 0
Posted

You can run cron tasks one at a time, but you cannot force it to ignore its schedule. If you could force a task to run, some issues may arise, as some tasks perform actions that could have a negative impact if they were to run more often than their scheduled interval, such as the Create Invoice task.

  • 0
Posted

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?

That means it's running or has froze.

  • 0
Posted

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.

  • 0
Posted

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?

  • 0
Posted

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.

  • 0
Posted

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.

  • 0
Posted

I want to note this is in a windows environment; pretty sure Windows doesn't use cron, but "services" - though since I am running it manually it shouldn't matter!?

 

FTR....... it's still stalled and no link has shown to kill it.

  • 0
Posted

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.

  • 0
Posted

Yep, sorry, got services confused with scheduled tasks. Will give that a go and try again.

 

When I am ready to run it can I just click the run manual button? As it still seems to be stuck on "Attempting to deliver invoices scheduled for delivery." and the loading image is still showing.

  • 0
Posted

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.

  • 0
Posted

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.

  • 0
Posted

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.

  • 0
Posted

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"?

  • 0
Posted

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.

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...