WordPress.org

Forums

UpdraftPlus Backup and Restoration
[resolved] wp-cron.php and zip continue running (10 posts)

  1. Andy
    Member
    Posted 1 year ago #

    I monitor long running processes on my server (anything over 3 minutes). One thing that I have noticed since installing this plugin on a *somewhat* large site (lots of images) is that it leaves at least 5 instances of zip and wp-cron.php running *after* completion. And it *does* run to completion - I get a notification that it finished.

    Can this be explained somehow?

    This morning, I've moved the calling of wp-cron.php actually into cron, but I think that won't actually resolve the issue. What might, however, is getting updraft out of the wp-cron mix, and into a cron job of its own. If I do that (I see the php code I need to add on the Updraft site), then how do I get rid of the "regularly scheduled" backup?

    Thanks!

    https://wordpress.org/plugins/updraftplus/

  2. David Anderson
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Andy,

    Those must be zombie processes; if they were actually doing anything, then later UD runs would detect them. (UD checks the file modification times of the zips its working on).

    To switch to a different zip engine that doesn't use external zip binaries, add this to your wp-config.php:

    define('UPDRAFTPLUS_NO_BINZIP', true);

    For stopping regularly scheduled backups, choose "Manual" from the list of options for backup schedules on the UD settings page.

    David

  3. Andy
    Member
    Posted 1 year ago #

    Thanks, David. A bit of a "duh" moment on my part with the "manual" setting. [sigh]

    As noted on the UpdraftPlus site, I created a file with the following contents, called runbackup.php on the / of my webserver:

    <?php
    
    define('UPDRAFTPLUS_CONSOLELOG', true);
    require_once('wp-load.php');
    do_action('updraft_backup_all');
    
    ?>

    When I run it with:
    /usr/local/bin/php ~/web/runbackup.php
    it seems to still use the "stepped" method. Is there anything that will let it just blast through the whole process, and get it over with?

  4. David Anderson
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Andy,

    What's the "stepped" method?

    David

  5. Andy
    Member
    Posted 1 year ago #

    The 9 steps that the plugin goes through, which has big pauses in between the steps... My first test run with the above php file took about 3 hours to complete, and that seems a tad ridiculous.

    And it still left zombie processes. :-/

    If you like, I'll send you a copy of the logfile...

  6. David Anderson
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Andy,

    OK - those aren't "steps"; those are restarts of a job for which the PHP process died. That shouldn't be able to happen from the command line, unless your server has something that detects and kills off long-running PHP processes. Post the log (e.g. pastebin.com) and I can take a look. Please confirm that it's a log generated from the shell.

    How long it takes is a function of the speed of the webserver and the size of the website. A default WP install on my cheap laptop takes about 4 seconds. So presumably you have a vast amount of data in the WP site.

    Are you sure you set UPDRAFTPLUS_NO_BINZIP? Or that the zombie processes you're seeing aren't old ones? That settings prevents UD from opening zip as an external binary, so there shouldn't be any subprocesses to begin with - let alone ones which later become zombies.

    David

  7. Andy
    Member
    Posted 1 year ago #

    It ran last night a bit better, I think. I've put the logfile here: http://pastebin.com/TR97efmJ

    I haven't yet swapped the zip off the binary - that will be my next step...
    That run last night produced the following zombied processes:

    [~]# ps -ef | grep USERNAME
    USERNAME  21273  5400  0 02:40 ?        00:00:00 crond
    USERNAME  21276 21273  0 02:40 ?        00:00:00 /bin/sh -c /usr/local/bin/php /home/USERNAME/public_html/runbackup.php >/dev/null 2>&1
    USERNAME  21277 21276  0 02:40 ?        00:00:00 /usr/local/bin/php /home/USERNAME/public_html/runbackup.php
    USERNAME  21301 21277  0 02:40 ?        00:00:00 /usr/bin/zip -v -@ /home/USERNAME/public_html/wp-content/updraft/backup_2014-03-12-2340_SITE_NAME_REPLACED_440d3520ef60-plugins.zip.tmp
    USERNAME  21558 20398  0 02:45 ?        00:00:00 /usr/bin/php /home/USERNAME/public_html/wp-cron.php
    USERNAME  21563 21558  0 02:45 ?        00:00:00 /usr/bin/zip -v -@ /home/USERNAME/public_html/wp-content/updraft/backup_2014-03-12-2340_SITE_NAME_REPLACED_440d3520ef60-plugins.zip.tmp
    kingster 22439 21534  0 08:42 pts/0    00:00:00 grep USERNAME
    USERNAME  22534 21622  0 03:00 ?        00:00:00 /usr/bin/php /home/USERNAME/public_html/wp-cron.php
    USERNAME  22540 22534  0 03:00 ?        00:00:00 /usr/bin/zip -v -@ /home/USERNAME/public_html/wp-content/updraft/backup_2014-03-12-2340_SITE_NAME_REPLACED_440d3520ef60-plugins.zip.tmp
    USERNAME  31639 31359  0 03:15 ?        00:00:00 /usr/bin/php /home/USERNAME/public_html/wp-cron.php
    USERNAME  31645 31639  0 03:15 ?        00:00:00 /usr/bin/zip -v -@ /home/USERNAME/public_html/wp-content/updraft/backup_2014-03-12-2340_SITE_NAME_REPLACED_440d3520ef60-plugins.zip.tmp

    Actually prevented the cron job from "completing". :-(

  8. Andy
    Member
    Posted 1 year ago #

    Yeah... Swapping to the non-binary zip totally made a difference. No zombie processes, and much faster... See the log here: http://pastebin.com/HM3BBr45

  9. David Anderson
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Andy,

    Great, glad you got it working.

    Best wishes,
    David

  10. Andy
    Member
    Posted 1 year ago #

    Just to sum up the thread for anyone else... I have UpdraftPlus backing up a somewhat large site (lots of pics!). For some reason, it really didn't like some of the default settings, and in addition, I didn't like the lack of control I got with the usage of wp-cron.php. So!

    I added the following settings to my wp-config.php just before the "Stop Editing" line:

    /**
    * Turn off the running of wp-cron.php page based on visits because it sucks
    */
    define('DISABLE_WP_CRON', true);
    
    /**
    *Tell UpdraftPlus to use a non-binary ZIP
    */
    define('UPDRAFTPLUS_NO_BINZIP', true);

    The first line turns off wp-cron. I call that page with a real cron job every 15 minutes. The second line tells UpdraftPlus to use a non-binary zip tool (maybe embedded in PHP?).

    The next thing I did was create a PHP file in my site's / (root) directory - which is where I run WordPress from. I called the file runbackup.php, with the following contents:

    <?php
    
    define('UPDRAFTPLUS_CONSOLELOG', true);
    require_once('wp-load.php');
    do_action('updraft_backup_all');
    
    ?>

    Finally, I created two cron jobs. One runs the wp-cron.php via wget, the other runs the backup every night at 2:40AM:

    */15  *  *  *  *  wget -q -O - http://website.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
    40  2  *  *  *  /usr/local/bin/php /home/username/public_html/runbackup.php >/dev/null 2>&1

    (obviously, you'll need to replace the website.com and username).

    This makes it so the site backs up quickly, and at a repeatable time every day.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • UpdraftPlus Backup and Restoration
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic