Scheduled snapshots and wp-cron disabled.

Hi

I've set up scheduled snapshots on this multi-site to send to Amazon S3 on a daily basis. I have this working well on other Multi-sites on the same VPS.
My problem with this one is that I have wp-cron disbabled in the wp-config file (due to performance issues). I currently have a true cron set to run every 2 hours.

This does not seem to trigger the scheduled snapshots.

Is there any way to do this without wp-cron?

Any help you can give would be appreciated.

Thanks

  • Paul

    @octavian,

    My problem with this one is that I have wp-cron disbabled in the wp-config file (due to performance issues). I currently have a true cron set to run every 2 hours.

    Ok. from your cron entry what are you calling? You should be calling the wp-cron.php file in your site root. Is you search the internet you will find many example of how to setup alternatives to WP_Cron. Here is one http://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress

    In all the alternative solutions you still need to call the /wp-cron.php in your site. There is no option to call snapshot directly as it needs the WordPress environment to function.

  • Paul

    Am I right in thinking that the snapshot will be created the next time there is a call to wp-cron.php? Will this then be transferred to Amazon S3 in the normal way.?

    Maybe or maybe not. When you click the Snapshot 'Run Now' what is does behind the scene is call the WordPress wp_schedule_single_event() function to register the single WP_Cron entry. This is different than when you set the snapshot configuration to run on a certain interval using the WordPress wp_schedule_event() function.

    I say maybe because after all this time there seems to be no rhyme or reason for some of the WP_Cron quicks. Yes, you would think that after clicking the snapshot 'run now' and the single event is scheduled that then when WP_Cron is finally executed some time in the future it will call snapshot to run. Bud sadly this is not always the case. I've seem times when WP_Cron will clear out 'stale' entries that have pasted. But I have no idea what that threshold is for determining 'stale' entires.

  • octavian

    Hello Paul

    OK, unfortunately the scheduled backups didn't run.

    I've set the call to wp-cron.php to run every 5 minutes and have an email alerting me that this is the case.

    In the schedule settings I have the following warning in red:
    "Your site has disabled the WordPress Cron scheduler (WP_CRON). When scheduling an archive to be created it may not run. Check your wp-config.php for the DISABLE_WP_CRON define. If found either remove it or set the value to "false"."

    When I have set up snapshots and schedules in one of my other multi sites on the same VPS (without wp-cron disabled), the snapshot has been created and sent to Amazon straight away and then the scheduled one run 24 hours later. On the multi site that is giving me the problems, no snapshot is created and the date for next snapshot remains the same.

    Any ideas?

    Thanks
    Ian

  • Paul

    @octavian

    OK, unfortunately the scheduled backups didn't run.

    Hmm. Bummer.

    In the schedule settings I have the following warning in red:
    "Your site has disabled the WordPress Cron scheduler (WP_CRON). When scheduling an archive to be created it may not run. Check your wp-config.php for the DISABLE_WP_CRON define. If found either remove it or set the value to "false"."

    Yes, that is there for those users who are not aware that their hosting or some security plugins has gone through and disabled WP_CRON for them. Quite annoying when we try and to help them figure out why Snapshot is not running.

    Any ideas?

    Other than asking you to enable WP_Cron, none. Or maybe instead of relaying on the 'run now' can you just set the snapshot to run on an interval. Then the real cron calling wp-cron.php should work, no? Maybe you have tried that. Sorry a long day.

  • octavian

    Or maybe instead of relaying on the 'run now' can you just set the snapshot to run on an interval. Then the real cron calling wp-cron.php should work, no? Maybe you have tried that.

    Yes... I've tried that. All the snapshots are scheduled at once daily. I'll try setting a snapshot for every 10 minutes on a small site and see if any of them run.

    I'll let you know the outcome.

    Thanks
    ian

  • octavian

    OK, so now I tried setting the snapshot to schedule every 5 minutes and nothing happened.

    So then I commented out the disable in the wp-config file and all the scheduled backups ran straight away and uploaded to amazon. The one set at 5 minutes is running every 5 minutes.

    The issue I will probably have now is an increase in cpu load on the server which was the reason for disabling wp-cron in the first place.

    I will look at this in an hour to see the effect on load.

    I will then try disabling wp-cron again and check to see if the 5 minute snapshots stop,

    I'll let you know.

    If you think of anything else, let me know.

    Thanks
    Ian

  • Paul

    So then I commented out the disable in the wp-config file and all the scheduled backups ran straight away and uploaded to amazon. The one set at 5 minutes is running every 5 minutes.

    Oh great. So these are stored for WP_Cron.

    I will then try disabling wp-cron again and check to see if the 5 minute snapshots stop,

    On other thought on that. Try installing Cron View ( http://wordpress.org/plugins/cron-view/ ) or some other cron plugin which should show what WP has scheduled.

    But yeah back to the original issue of to to setup the external cron. Can I ask you to show me exactly what you are calling in your system crontab?

  • octavian

    Can I ask you to show me exactly what you are calling in your system crontab?

    This is what I am calling.
    */5 * * * * cd /home/user/public_html; php -q wp-cron.php

    When disable wp-cron was commented out, unfortunately cpu usage went through the roof within an hour and made server performance unrealistic.

    I've now disabled wp-cron again and cpu is back to normal the five minute snapshots have stopped again, but email notifications are continuing.

    I'll add the plugin as you suggest.

    Thanks
    ian

  • Paul

    @octavian,

    Any idea where to start?

    Well I would start with reviewing the cron view items before re-enabling he WP_Cron. You might be able to identify some other plugin or some process of WordPress which is causing the issue.

    The other thing is it do more searching on why your real cron does not seem to be starting WP_Cron. From what I understand your real cron should be in effect calling the WP_Cron scheduler (wp-cron.php) at your own interval.

    Normally when a front-end page is loaded there is a secondary process within WP core that will load /wp-cron.php By disabling cron you are stopping this automatic secondary process and replacing it with your real cron which you can control the interval.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.