Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

backup_incomplete file, not deleted old backups

Discussion in 'Data Protection' started by postcd, Oct 18, 2017.

  1. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    694
    Likes Received:
    15
    Trophy Points:
    68
    find /backup -name backup_incomplete|sort -h
    Hello, these files are empty, but makes me wonder what is wrong. At same time i have set Retention 5 in Daily backups section of the WHM/Backup configuration. So it is strange older backups are not deleted per above output. The "Strictly enforce retention, regardless of backup success." is not ticked.

    Update: temporarily until this is solved, i setup a cronjob to delete all daily backups in /backup except 7-1=6 last/newest backups:
    50 22 * * * root for dailybackupdir in $(ls -t -A1 /backup|grep -|tail -n +7);do /usr/bin/ionice -c2 -n7 find /backup/"$dailybackupdir" -delete;done
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 postcd, Oct 18, 2017
    Last edited: Oct 18, 2017
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    969
    Likes Received:
    380
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    The docs suggest that the pruning of backups using the Strictly enforce retention, regardless of backup success switch will only happen after at least 1 (one) completed successful backup
    Backup Configuration - Documentation - cPanel Documentation
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPWilliamL

    cPWilliamL cP Technical Analyst II
    Staff Member

    Joined:
    May 15, 2017
    Messages:
    258
    Likes Received:
    29
    Trophy Points:
    103
    Location:
    America
    cPanel Access Level:
    Root Administrator
    @postcd, That cron seems a bit dangerous to me. If, for whatever reason, '$dailybackupdir' isn't set, you'll delete all your backups. You may consider setting nounset:
    BashFAQ - Greg's Wiki

    Really, the entire forloop could be replaced by one find command.

    Regardless, I would recommend investigating why your backups are failing. You can use the oneliner below to check all backup logs for all errors that would lead to an incomplete backup(paste the entire command at once):
    Code:
    for log in /usr/local/cpanel/logs/cpbackup/*; do printf -- "------------------------------\n%s:\n" "$log"; while read err; do grep "$err" "$log"; done <<EOF;done
    Unable to get user id
    Unable to load cPanel user data
    You cannot copy the root user
    pkgacct failed to copy daily backup
    Could not use daily backup
    Bailing out
    The REMOTE_PASSWORD variable is missing
    Unable to find domain name
    Exiting with error code
    Could not remove directory
    Hook denied execution of pkgacct
    Could not open
    Could not chmod
    Could not rename
    failed to create the working dir
    Unable to fork
    Unable to waitpid
    Unable to open
    Failure dumping
    Unable to read
    does not appear to be valid XML
    Could not create directory
    mysqldump: Got error
    mysqldump failed
    EOF
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    694
    Likes Received:
    15
    Trophy Points:
    68
    Backups was not created, i run above mentioned script to find errors in backup logs and this was found:
    In WHM / Backup / Backup Configuration, the "Default Backup Directory" is set to "/backup".

    The directory exist, but is empty:
    Code:
    # ls -la /backup; stat /backup
    total 8
    drwx--x--x  2 root root 4096 Nov  1 02:00 ./
    drwxr-xr-x 32 root root 4096 Oct 31 10:40 ../
      File: `/backup'
      Size: 4096            Blocks: 8          IO Block: 4096   directory
    Device: f1h/241d        Inode: 41829777    Links: 2
    Access: (0711/drwx--x--x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2017-11-01 03:28:02.426860500 +0000
    Modify: 2017-11-01 02:00:06.000000000 +0000
    Change: 2017-11-01 03:22:49.607780815 +0000
    I ran the backup manually from command line: /usr/local/cpanel/bin/backup --force
    and it seems to finished and files are there in /backup and no "backup_incomplete" file.
    [2017-11-01 10:21:55 +0000] info [backup] Completed at Wed Nov 1 10:21:55 2017
    [2017-11-01 10:21:56 +0000] info [backup] Final state is Backup::Success (0)
    [2017-11-01 10:21:56 +0000] info [backup] Sent Backup::Success notification.

    a few days passed and backups are now created automatically without issue. Do not know why it was nto working.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice