Snapshot Not Running When Scheduled

I've created a new snapshot, scheduled to run each day. It doesn't run at all though, even if I click run now. Cron seems to be working effectively but the backup just won't run. If I create a new snapshot to run immediately, that does work.

  • Rahul Verma
    • The Incredible Code Injector

    Hello,

    I hope you are well today and Thanks for posting on the forums.

    Can you please try enabling WP_DEBUG mode and debug logging? To do this, just go to wp-config.php include this:

    define('WP_DEBUG',true);
    define('WP_DEBUG_LOG',true);

    You might already have a line for WP_DEBUG, so just make sure it's set to true. This will create a log file under wp-content/debug.log with detailed information.

    If you'd like to avoid end users seeing error messages, you can include this as well:

    @ini_set('display_errors',0);
    define('WP_DEBUG_DISPLAY', false);

    This will prevent errors from being displayed, but you can still find them in the log file.

    Let me know what errors if any you are getting!

    Best Regards
    Sandeep Kumar

  • Michael
    • Design Lord, Child of Thor

    Hi Sandeep,

    This is the only error I'm getting when enabling debugging:

    [30-Apr-2014 09:07:48 UTC] PHP Deprecated: Assigning the return value of new by reference is deprecated in /home/sites/silcoatesdiploma.co.uk/public_html/wp-content/plugins/login-redirect/login-redirect.php on line 146

    Michael

  • Paul
    • The Green Incsub

    @Michael,

    Cron seems to be working effectively but the backup just won't run.

    How sure are you about WP_Cron running?

    On the Snapshots > All Snapshots listing in the top-right of the page just above the table you should see a time for next run. This is set to be on 5 minute intervals. It should always be at most 5 minutes in the future. It should never be in the past.

    Try installing CronView ( http://wordpress.org/plugins/cron-view/ ) or any Cron plugins to see what is in cron.

    Basically how this works with Snapshot. Snapshot registers a callback function with the WP Scheduler (WP_Cron) to be called at some timestamp in the future. When that timestamp is reached the WP_Cron system will call the snapshot function to start the backup. So if the snapshot function is not being called then your cron is not correctly running.

    On the other hand this may be something with Snapshot. Have you checked the snapshot logs? They are located in /wp-content/uploads/snapshots/_logs. You will see a log file for each item in the All Snapshots listing. You can safely remove the logs then set one snapshot item to run at a 5 minute interval. This way you don't need to wait for the next cycle. After the time passes check the snapshots log folder for the related log file and let us know what you find.

  • Michael
    • Design Lord, Child of Thor

    Hi Paul,

    Cron seems to be working. in cron view, the snapshot process seems to be created:

    Apr 30, 2014 @ 11:11 (1398856270) Every 5 Minutes snapshot_backup_cron
    [0]: 1391008617

    But, it never runs. The log doesn't get created either (unless I run it manually).

    Michael

  • Paul
    • The Green Incsub

    @Michael,

    That you see the report of the snapshot function 'snapshot_backup_cron' showing in cron view does not really mean it is running. This just shows what cron entries are registered within WP_Cron.

    In your browser try going to http://www.yoursite.com/wp-cron.php where 'www.yoursite.com' is the actuality URL for your site. See if you can kick off WP_Cron manually. The WP_Cron does need front-end traffic to run.

  • Paul
    • The Green Incsub

    @Michael,

    I just get a blank screen when running wp-cron.php manually. Is this expected?

    Yes, this is just a stub file used by WordPress to kick off the internal WP_Cron scheduler. How this normally works is when someone loads your home page or some front-end page, WordPress will make a call from some internal function to that same URL. This is how WP_Cron keeps running tasks.

    Let's get back to Snapshot. On the All Snapshots listing in the 'Interval' column you should see the items scheduled for run by WP_Cron. The 'Next:' time showing is taken directly from WP_Cron. Is that time time showing some future time? OR is it showing past time? If it is showing past time then WP_Cron is not running as expected.

  • Paul
    • The Green Incsub

    @Michael,

    I'm sort of at a loss. Without errors or something showing in the snapshot logs or the server logs I don't have an what to suggest. At part of Snapshot when the WP_Cron calls the function the first thing it does it write out a log entry that the process is starting. Still makes me thing there is some disconnect.

    Other then access to your site I don't have any ideas at the moment. Sorry.

  • Michael
    • Design Lord, Child of Thor

    Further to this, reading other threads about wp cron, it appears that this is the issue I'm having. If I run wp-cron.php?doing_wp_cron, the schedule seems to run. I'm having another problem sending to a remote destination though now. When sending via ftp, I get the following error:

    ERROR: Undefined index: verification-bing

    The ftp test connects OK.

  • Michael Bissett
    • Recruit

    Hey @Michael, hope you're doing well today. :slight_smile:

    I'm having another problem sending to a remote destination though now. When sending via ftp, I get the following error:

    ERROR: Undefined index: verification-bing

    The ftp test connects OK.

    I see that this is being dealt with in this thread:

    https://premium.wpmudev.org/forums/topic/i-cant-ftp-my-snapshot-file-looking-at-the-logs-it-fails

    So I'll leave that issue for there. However, in regards to this:

    Further to this, reading other threads about wp cron, it appears that this is the issue I'm having. If I run wp-cron.php?doing_wp_cron, the schedule seems to run.

    I noticed that in the other thread you mentioned that you were going to disable some plugins, but could you disable everything else, aside from Snapshot? And also trying the Twenty Fourteen theme, in case the theme's getting in the way here?

    While researching this, I found that the W3 Total Cache plugin has interfered with this in the past, I'd try disabling it (if you have it installed) to see if it'll allow Snapshot (and cron jobs in general) to work automatically.

    Please advise,
    Michael

  • Michael Bissett
    • Recruit

    Hey @Michael, hope you're doing well today. :slight_smile:

    Could you send over WP Admin & FTP access details, along with a link to this thread, to contact(at)wpmudev.org (with the subject line Attn: Michael Bissett)?

    It sounds like we're going to have to take a deeper look at things here.

    Thanks!

    Regards,
    Michael

  • Michael Bissett
    • Recruit

    Hey @Michael,

    After digging into this quite a bit, doing manual, immediate snapshots, it looks like we're running into a 504 Gateway Time-out here.

    I don't see this issue if I'm just backing up the media files & the databases. But, as soon as I include either the themes or the plugins in the snapshot, that's where I run into trouble.

    The interesting thing though, is that if I do a snapshot with only the themes and the plugins included in the snapshot, it works just fine.

    I've called in our SLS staff, as they'd be more qualified to handle this issue. One of them should be along shortly.

    Regards,
    Michael

  • Michael
    • Design Lord, Child of Thor

    Thanks Michael. Incidentally, any manual backups that I've done, have worked fine, it's just the scheduling that never kicks in. Not sure if that's been the issue for you.

    I'll wait for your advice.

    Regards,

    Michael

  • Hoang Ngo
    • Code Slayer

    Hi @Michael,

    I hope you are well today and I'm sorry about the delay.

    This issue is really weird, just for clarify, does your host using cpanel or something else for management.

    Because you told if we access to the wp-cron.php it self, the plugin seem working. So I intend to place a small cronjob on your server, which will request to the url in amount of time. This can make the schedule feature work.

    Also the wordpress cronjob will need request for it to be run. So if your site don't have access, it will not run.

    Please advise,
    Thanks!!!

    Best regards,
    Hoang

  • Michael
    • Design Lord, Child of Thor

    Hi Hoang,

    I'm using HeartInternet.co.uk for my hosting, which uses their own Control Panel called extend. It does seem possible though, to add scheduled jobs.

    Please can you let me know what needs doing. I'm happy to give you access to the control panel, if you need.

    Thanks,

    Michael

  • Hoang Ngo
    • Code Slayer

    Hi @Michael,

    Thank you, that's really cool. Can you please send in:

    - Mark to my attention - ATTN: Hoang Ngo
    - Link back to this thread
    - Include admin/network access
    - Include cPanel (I will need to look at the DB so need PHPMyAdmin or similar)
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    Best regards,
    Hoang

  • Ian
    • The Incredible Code Injector

    I can also confirm there is a problem with the latest Snapshot.

    It has stopped working on several of my websites. Had it to backup twice weekly and it has done no backups in June.

    Some sites are very basic with not many plugins so it doesn't seem to be a conflict with other plugins.

    Before June, Snapshot would work like clockwork with no problems at all, month after month.

    Nothing has changed during June, other than just the normal upgrades.

    Could it be a conflict with the latest WordPress?

    I can do manual backups fine.

  • Hoang Ngo
    • Code Slayer

    Hi @Michael,

    Sorry, it seem the "wget" or "curl" command not working, hmm this is weird because both that commands are general from hosting nowaday.

    May I use the terminal command to your host ?, so I will easier to check the command, and surely this will not impact your website.

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.