Linuc82 Posted November 7, 2022 Share Posted November 7, 2022 I have a strange issue that started last week. My whmcs daily cron is set to execute at 00:00 in the automation settings. For some strange reason it runs at 23:00 and then again at 0:00. Every single night. This is on an established system that has been running for years without any issues. I've check the PHP Timezone as well as the server timezone. also added date_default_timezone_set('America/Los_Angeles'); in the configuration.php file just in case. I cannot find any reasonable explanation as to why it would run exactly 1 hour before the actual scheduled time, and then again at the time set in the automation settings. If it was a timezone issue, it would then just execute at the wrong time, but in this case it runs twice, which is causing cron errors. Running the cron by force in CLI it completes without an issue. 0 Quote Link to comment Share on other sites More sharing options...
Linuc82 Posted November 7, 2022 Author Share Posted November 7, 2022 (edited) Update: I just discovered something very weird. Right in the middle of the WHMCS Daily Cron run, the time changes 1 hour back: 07/11/2022 01:06 Email Sent to ***** (Domain Renewal 07/11/2022 01:06 Domain Renewed Successfully - Domain ID 07/11/2022 02:06 Invoice Marked Paid - Invoice ID 07/11/2022 02:06 Running Automatic Domain Renewal on Payment My Daily Cron is set to run at 2am. See how mid-automation tasks the time changes from 2am to 1am. This causes other issues, such as the cron reporting that it did finish. Edited November 7, 2022 by Linuc82 0 Quote Link to comment Share on other sites More sharing options...
xyzulu Posted November 7, 2022 Share Posted November 7, 2022 Check your server time... not just php.. though the cron runs on a the php cli time.. and not the php (web) time. 0 Quote Link to comment Share on other sites More sharing options...
Linuc82 Posted November 9, 2022 Author Share Posted November 9, 2022 The server time, php time and whmcs configuration time is set to the exact same time. So, I monitoring the Activity logs very closely over the last few days. As mentioned, my Daily Cron starts off at the correct time, 2am. But during the cron run it changes 1 hour back. Monitoring the Activity Log I noticed that it happens every time during the "CreateInvoices" function run. I "skip --CreateInvoices" during my 5 minute cron and moved it to it's own "do --CreateInvoices" set to 3am. Bam, the Daily Cron finished without any errors. The issue is definitely with "CreateInvoices". Checking the Activity Logs again at 3am the system start off creating new invoices at 3am, but after 10 invoices or so, the time changed again from 03:01 to 02:01. 09/11/2022 02:01 Email Sent to O**** A****** (Domain Renewal: xxxxx) 09/11/2022 02:01 Domain Renewed Successfully - Domain ID: 200300 - Domain: xxxx 09/11/2022 03:01 Running Automatic Domain Renewal on Payment 09/11/2022 03:01 Invoice Marked Paid - Invoice ID: xxxx At this point in time I don't think it is a timezone issue at all, rather that whmcs cron starts recording the incorrect time at some point during the "CreateInvoices" function run. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.