Jump to content
  • 0

Auto Debit Cron Stopped Since Dst


evolvewh

Question

Not sure if this is a bug, a configuration issue on my part or what but I have noticed that cron is running and every task seems to work except for auto debit. I did wait one extra hour as well. It last worked on Saturday with no issues.

 

There is nothing in the error logs and the payment gateway works when I manually process the invoice. I'm using Stripe.

 

Anyone else seen this?

Link to comment
Share on other sites

Recommended Posts

  • 0

I've now got this working for 2 days in a row and I'm pretty certain this is the fix.

 

For anyone using cPanel and having issues, you may want to try this format for your cron command:

 

*/5 * * * *

/usr/local/bin/php /home/your_cpanel_username/public_html/index.php cron/?cron_key=your_cron_key

 

If you update the cron key from the admin area of Blesta, you'll need to update this command too.

 

Hope this helps others out as well.

 

If it works for others, maybe this link could be updated: https://docs.blesta.com/display/user/System+%3E+Automation

 

Also, I don't want to add clutter but it may be helpful to have a link within Blesta's admin to point users to this documentation.

Link to comment
Share on other sites

  • 0

So the auto debit task appears to be stuck running under Settings > Company > Automation?

 

The best way to debug this is to enable error reporting in your config file. Temporarily disable cron from automatically running (right before auto debit would normally run), and then run the cron manually under Settings > System > Automation after auto debit is scheduled to run. Any errors should be output to your browser.

 

To enable error reporting, edit /config/blesta.php and change
 
Configure::errorReporting(0);
 
to
 
Configure::errorReporting(-1);
Link to comment
Share on other sites

  • 0

It sounds like the cron tasks are completing. What version of Blesta are you running? There was a bug in an older version that caused the auto-debit status to appear enabled when it was not. Re-saving it / toggling it off and back on, and re-saving the payment account for auto debit would correct it in those cases.

Link to comment
Share on other sites

  • 0

Just following up on this, everything still working properly with your auto debit cron?

I appreciate the follow up. For the most part, it's good but I did have one that should have ran today and it didn't. I've got more due over the next few days and I will make sure I'm at my computer to turn on error reporting in case it acts up again.

 

I'm now running 3.6.1 and the upgrade went through with no issues.

 

Thanks!

Link to comment
Share on other sites

  • 0

 

So the auto debit task appears to be stuck running under Settings > Company > Automation?

 

The best way to debug this is to enable error reporting in your config file. Temporarily disable cron from automatically running (right before auto debit would normally run), and then run the cron manually under Settings > System > Automation after auto debit is scheduled to run. Any errors should be output to your browser.

 

To enable error reporting, edit /config/blesta.php and change
 
Configure::errorReporting(0);
 
to
 
Configure::errorReporting(-1);

 

 

Paul,

 

I'm not sure what you mean by disabling it. Do I remove the cron from cPanel or do I disable Auto Debit under Settings -->> Company -->> Automation and then manually run cron? I disabled it under Settings -->> Company -->> Automation, ran cron manually from Settings -->> System -->> Automation and it didn't run Auto Debits. My settings are to charge the card 1 day in advance of the due date.

 

Update: I don't understand this but here's what happened:

 

I put all of my settings back to normal and it ran as it should.

 

I tried to manually run the cron about an hour before the normal scheduled time and it didn't process the invoice.

 

At this point, I'd say that we'll leave this one alone. It's strange but not worth wasting time. I'll certainly report it again if I notice it acting up on a regular basis.

 

Thanks,

 

DL

Link to comment
Share on other sites

  • 0

I'm not sure what you mean by disabling it.

 

Disabling the cron for a particular task can be done either by 1) disabling the entire cron from your control panel such that the cron no longer automatically runs, or 2) disabling a specific cron task under the [settings] -> [Automation] page before it's scheduled to be run. In the latter case, when the cron runs automatically, it will not run the task you disabled. At this point, re-enable that task under [settings] -> [Automation] and immediately run the cron manually to view it's output.

 

 

I tried to manually run the cron about an hour before the normal scheduled time and it didn't process the invoice.

 

Running the cron an hour before the task is scheduled to run will not run the task. This is because it is not time to run the task yet per your Automation settings.

 

 

I disabled it under Settings -->> Company -->> Automation, ran cron manually from Settings -->> System -->> Automation and it didn't run Auto Debits.

 

 

If you disable the automation task, it cannot be run manually or automatically because it is disabled.

 

Tasks run only if they are enabled, and only when they're scheduled to run. The exception to this is if the task failed to run at its scheduled time. Depending on the task, it may be run the next time the cron runs or it will have to wait until the next time it is scheduled to run.

Link to comment
Share on other sites

  • 0

Disabling the cron for a particular task can be done either by 1) disabling the entire cron from your control panel such that the cron no longer automatically runs, or 2) disabling a specific cron task under the [settings] -> [Automation] page before it's scheduled to be run. In the latter case, when the cron runs automatically, it will not run the task you disabled. At this point, re-enable that task under [settings] -> [Automation] and immediately run the cron manually to view it's output.

 

 

 

Running the cron an hour before the task is scheduled to run will not run the task. This is because it is not time to run the task yet per your Automation settings.

 

 

 

 

If you disable the automation task, it cannot be run manually or automatically because it is disabled.

 

Tasks run only if they are enabled, and only when they're scheduled to run. The exception to this is if the task failed to run at its scheduled time. Depending on the task, it may be run the next time the cron runs or it will have to wait until the next time it is scheduled to run.

Thanks for the full explanation and I feel kind of dumb now! I'll go through this again tomorrow morning and see what happens.

 

Thanks.

Link to comment
Share on other sites

  • 0

Sorry if this is running on for too long but I can't seem to get any error report. I enabled error reporting in the config file, disabled the cron right before it should run, re enabled it and ran it manually. This is what I get:

 

Attempting to run all tasks for Evolve Web Hosting, LLC.
All tasks have been completed.
Attempting to run all system tasks.
All system tasks have been completed.

 

I have it set to run at 9am every morning and it actually said it did (I was running it manually after because I wasn't at the computer at 9am).

 

I've attached screenshots of my settings so it should have processed 3 invoices this morning.

 

post-499-0-53754300-1447345720_thumb.pngpost-499-0-18648400-1447345738_thumb.pngpost-499-0-79363300-1447345761_thumb.png

 

Should I open a support ticket with you guys and let you take a look at it?

 

 

Link to comment
Share on other sites

  • 0

The system doesn't think there are any invoices to be auto-debited.

 

Error reporting would only show you php errors if something had gone wrong with a task running. You can usually tell if something had gone wrong with the task if it starts running but does not complete successfully.

Link to comment
Share on other sites

  • 0

Since there are invoices that should be auto-debited today, what do I do from here, other than manually process them?

 

That's what I would suggest, if the auto debit task already ran today as it won't run again until tomorrow. For some reason, Blesta doesn't think those should be auto debited. I would double check that a payment account is selected for auto debit, that auto debit is enabled for the client, and that the invoices are due in accordance with the setting for auto debit days. You can open a ticket with us if you'd like me to login and take a look and see if anything is out of ordinary.

Link to comment
Share on other sites

  • 0

It doesn't make any sense because I have a client who had an invoice due yesterday and one due today. Yesterday, the first invoice was auto-debited. Today, the 2nd invoice didn't get auto-debited.

 

Auto Debit is enabled for everyone and their cards are up to date (not expired).

 

Thanks for your patience in trying to figure this out. I'll manually process them today and see what happens from there.

Link to comment
Share on other sites

  • 0

It doesn't make any sense because I have a client who had an invoice due yesterday and one due today. Yesterday, the first invoice was auto-debited. Today, the 2nd invoice didn't get auto-debited.

 

Auto Debit is enabled for everyone and their cards are up to date (not expired).

 

Thanks for your patience in trying to figure this out. I'll manually process them today and see what happens from there.

 

As stated above they might be enabled but it might not have been stored in the database clicking the card's bullet point and saving fixes it and it might run tomorrow.

Link to comment
Share on other sites

  • 0

As stated above they might be enabled but it might not have been stored in the database clicking the card's bullet point and saving fixes it and it might run tomorrow.

Agreed and I've done that but why did one invoice auto debit yesterday for a client and their next invoice today did not auto debit? That's the part that really makes no sense. Same client, same card and same payment gateway. Even the same module (domain renewals).

Link to comment
Share on other sites

  • 0

Disabling the cron for a particular task can be done either by 1) disabling the entire cron from your control panel such that the cron no longer automatically runs, or 2) disabling a specific cron task under the [settings] -> [Automation] page before it's scheduled to be run. In the latter case, when the cron runs automatically, it will not run the task you disabled. At this point, re-enable that task under [settings] -> [Automation] and immediately run the cron manually to view it's output.

 

 

I just tried #2

 

Guess I wasn't fast enough to make the changes and run it manually. I'll have to open a support ticket for this.

Link to comment
Share on other sites

  • 0

I think I have finally figured this out.

 

I looked in the settings table and it was never updating the cron_key when I changed that through the admin UI. I manually edited it through phpMyAdmin and auto debit worked perfectly this morning.

 

On a side note, database_version (3.6.0-b1 but I don't run betas on my live site) has not updated like it should and exchange_rates_auto_update was the same way.

 

I can guarantee that I ran the auto update script successfully.

Link to comment
Share on other sites

  • 0

On a side note, database_version (3.6.0-b1 but I don't run betas on my live site) has not updated like it should and exchange_rates_auto_update was the same way.

 

The database_version may not be the same as the version shown in the footer of the admin UI. The database_version of '3.6.0-b1' is the latest version. Don't change this value or you won't be able to upgrade.

The exchange_rates_auto_update setting from the `settings` table is not the value you would want to look at for your cron as the value from the `company_settings` table is used instead.

 

Be careful making modifications to the database if you're unsure how it will affect the system.

 

I'm not sure why the cron key would fail to update from the UI. Are you using the PHPIDS plugin by chance? If so, you might try disabling it and then trying to save the cron key to see if it works then.

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