Disable WP Cron

Home Forums BulletProof Security Pro Disable WP Cron

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #11988
    AITpro Admin
    Keymaster

    Email Question:

    Hi,

    All is working REALLY well in BPS!! Love the new auto-auto-restore feature! Now the techs with heart failure can do it too!

    I was given this hosting support link http://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress
    to help solve my resource usage issue (like forever) which I believe is related to floods of activity that is not native, but more attack like – they said during this last one they couldn’t see an attack, but said the cron was in constant use and to try this.

    Now, is BPS hooked into this? I set it exactly how the article states. Does this mean that BPS will only run every 6 hours with the new cron?

    /** { inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress } */
    define('DISABLE_WP_CRON', 'true');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    define('DISABLE_WP_CRON', 'true');
    
    new cron:
    
    cd /home/userna5/public_html/subdirectory; php -q wp-cron.php

    Thank you very much for a great product (about to sell another one, but not an affiliate because you should get it all).
    Deb

    #11989
    AITpro Admin
    Keymaster

    Yes, I assume that the AutoRestore Cron check will only run every 6 hours, but have never tested this so I cannot tell you exactly how this works.  What the would mean is that BPS Pro cron scheduled events would not happen when they are scheduled to happen.  ie AutoRestore|Quarantine would NOT check files every 2, 5, 10, 15, etc minutes and would instead check your website files every 6 hours.  The Plugin Firewall AutoPilot Mode would check things every 6 hours instead of every 5, 10, 15, etc minutes.  DB Backup cron shedules would be affected and scheduled backup jobs would not occur at the times you have scheduled them.  etc etc etc.

    #12003
    Deb
    Participant

    My hosting company is The ServInt Corporation, btw.  A frontline tech gave me the link to the article on inmotionhosting, after dealing again with one site on the server constantly over processing/memory. They said it was the wp-cron.php around 90% ? of the time that they could see.

    Could I set another cPanel cron for bps?  Say… every 15 minutes just to process that for ARQ? I’ll put everything back to normal if it doesn’t work as we expect. That may take 3 months to see as “attacks” have been down to almost zero for the site.

    #12004
    AITpro Admin
    Keymaster

    The ARQ Cron triggers Directory Iterators, which are very low resource usage compared to MySQL Queries so the resource drain even though the cron is firing very frequently is actually pretty low resource usage overall.  On the surface it appears that the ARQ Cron frequency is the cause of resource drainage, but we have only come across 1 case where the ARQ Cron was causing excessive resource drain.  In that particular case the person was trying to incorrectly monitor over 30,000 website files with ARQ. 😉  The ARQ Cron is designed to handle checking up to 5,000 files without causing any significant resource drain.  It has been stress tested at 15,000 files and does cause a noticeable performance loss/resource drain.  The typical WordPress site with ARQ setup correctly should only be monitoring between 1,200 to 3,000 files.

    We are planning on adding a real-time timer at some point, but this is not something easy to do so it will take some time to develop.  In the meantime, we will be creating more Cron Frequency option settings in either BPS Pro 8.2 or 8.3.

    1 minute
    5 minutes
    10 minutes
    15 minutes

    New Cron Frequency times that will be added
    30 minutes
    60 minutes

    #12223
    Maud
    Participant

    If your hosting provider doesn’t allow setting cronjobs, there are some webcron services like easycron.com

    #22735
    jenni101
    Participant

    [Topic has been merged into this relevant Topic]

    Hi,

    I’ve got an automated email reminder plugin, linked to the s2member framework plugin, that is failing to send one of it’s emails. The author suggests setting wp-cron to off and add this via my cPanel:
    I assume that by doing this, I will effect the ARQ/Cron settings in BPS, so not sure if this is OK to try as a ‘fix’ for this other plugin? Though i assume i could just set the ARQ/Cron to run at 10 mins too? Please can you tell me if this is advisable to do with BPS, or if I should only do this as a last resort to fixing this plugin’s problem?

    You want to add the following command, set to run every 10 minutes and this in my wp-config file:
    wget -O /dev/null -o /dev/null http://yourdomainname.com/wp-cron.php?doing_wp_cron
    define('DISABLE_WP_CRON', 'true');

    Many thanks, as always!

    #22740
    AITpro Admin
    Keymaster

    @ jenni101 – That is absolutely terrible advice.  It is the wrong approach to figuring out what the real problem is.  Pretty much the same thing as “throwing the baby out with the bath water” or “breaking 10 things to fix 1 thing”.  Since the author of that plugin gave you such terrible advice then avoid asking that plugin author any more questions.  And yes you will break BPS Pro and any of your other plugins that use crons.  So the real problem should be figured out and fixed instead of creating other problems for your website, other plugins, etc.

    #22747
    jenni101
    Participant

    As always, thanks so much for your advice and time. I will leave as is, and see if he has another fix, and if not I’ll just do without the second email reminder! If anything exciting comes to light I’ll post it here (along with the plugin name) so others can fix it too!

    many thanks,

    Jenny

    #23034
    jenni101
    Participant

    Just a quick check please re: the WP_CRON setting. I happened to look into my wp-config.php on another site (when installing Zen Cache Lite today) and noticed that this was at the top of the file:

    define('DISABLE_WP_CRON', 'true');

    From what I understand this should be set to ‘false’? or in my other sites it’s just not there at all, which I presume is correct?
    I have BPS Pro installed on this site too, but I have no idea where it came from! – and I presume I should remove/edit it to ensure BPS works properly???
    Many thanks.

    #23037
    AITpro Admin
    Keymaster

    Apparently this must be a popular thing to mess with these days.  I have received several questions about DISABLE_WP_CRON lately.  I updated this reply in this forum topic:  http://forum.ait-pro.com/forums/topic/disable-wp-cron/#post-11989 with some more info about what disabling the native WP Cron means and how it affects BPS Pro Cron Jobs.  By default the DISABLE_WP_CRON constant code is not in a wp-config.php file and you have to add it manually.  There may be some plugins that add this to the wp-config.php file.  Not really sure about that.  So to answer your question you can either delete it, comment it out or change the value to false to allow native WP Crons to work normally.  Personally I would never user DISABLE_WP_CRON and I cannot see any benefit of using that constant.  I have read why people use it or think they should use it, but honestly I don’t agree with any of the stuff that I have read so far. 😉

    #23040
    rafaelmagic
    Participant

    @Admin
    Wordpress Cron is a pseudo cron. It is triggered on site and page views. If you site has little traffic or no traffic, then your WordPress Cron jobs are NOT triggered. Here is a better elaborate explanation: http://www.smashingmagazine.com/2013/10/16/schedule-events-using-wordpress-cron/

    To avoid having to create a Cpanel cron job (FYI which may differ per server) and prevent having to add code to wp-config. Just use the following service: https://uptimerobot.com/

    Its Free and it checks if your site is Down by hitting HTTP and as a result it also triggers WP-CRON and all your events and stuff hooked into cron jobs will run. The service checks every 5 minutes, so its like having a Cron Job that runs every 5 minutes.

    Rafael
    http://www.rafaelmagic.com

    #23050
    jenni101
    Participant

    Thanks for all your help – am getting to grips with it a bit more now!
    After some digging into it all a bit more and checking for cron jobs via my cPanel, I think I’ve found out what happened. My old site that I moved to our current server had lots of issues with timing out/crashing initially and my server thought it might be related to the wp-cron so they disabled it and set up the cron jobs in cPanel to run every hour. But then they found a historical (very large) full directory backup that the site was always trying to load – hence the timing out problem – so they deleted it and all was sorted. But I didn’t really understand about the wp-cron (and didn’t have BPS installed then) so just left it as it was and totally forgot about it!
    So I’ve now deleted the ‘disable wp-cron’ line from my wp-config.php and deleted the cron jobs in my cPanel, and hopefully all will be sweet!
    Thanks for all your help – much appreciated, particularly as it stops me from panicking and doing something really stupid.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.