Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Dimitar Petrov

    (@demiro)

    Hello @sean-h,

    The returned warning is not expected. I have performed several tests on test installations and there was no such warning message. Please note that this is not a fatal PHP error and if you have confirmed that the Cron is executed correctly, you can safely disregard the message.

    The issue could be generated by another plugin’s script execution triggered by the Cron. You can disable all plugins and test again. Also, you can check the wp-config.php file for any unused directives.

    If you are triggering the wp-cron execution via curl/wget or even by directly executing the file with PHP-CLI, I would highly recommend you to consider using WP-CLI. The required command you can find in the article below.
    https://eu.siteground.com/tutorials/wordpress/real-cron-job/

    Once you test the execution, you can define the Cron with the output redirect to /dev/null in order to avoid the automatic notification mails sent by the Cron service as the WP-CLI always returns output.

    Best Regards,
    Dimitar

    Thread Starter Sean

    (@sean-h)

    Hi Dimitar,

    Thanks for getting back to me. I have been using php-cli cron, on all 6 of my SG hosted sites, for years. I only discovered this message when trying something else and I allowed emails.

    /usr/local/php81/bin/php-cli /home/customer/www/mysite.co.za/public_html/wp-cron.php >/dev/null 2>&1

    Disabling every plugin one by one will be a bit of work because even though my crons run every 5 mins, this would still take ages. I have 23 plugins on one of my sites, and all my sites are doing this. And, I can’t do this in staging as running crons in staging isn’t the best idea, which is why crons are disabled in there. Doing it live is just not an option.

    Now seeing as this warning mentions sg-cachepress I thought to ask in here. But as you say, it is not a fatal error, and with emails turned off, all seems just fine.

    • This reply was modified 1 year, 4 months ago by Sean. Reason: Added more info
    Thread Starter Sean

    (@sean-h)

    Update: This seems to have fixed the warning, at least it hasn’t come back:

    cd /home/customer/www/yourdomain.com/public_html; wp cron event run –due-now >/dev/null 2>&1

    With emails allowed, all I get now is a success message, if any crons are run, such as this:

    Executed the cron event ‘action_scheduler_run_queue’ in 0.014s.
    Success: Executed a total of 1 cron event.

    Still, I’m curious why I got a warning referring to SG Optimizer.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cron job warning’ is closed to new replies.