Question
How does cPanel determine if a backup failed?
Answer
cPanel analyzes the outcome of each backup session to determine if a problem occurred during the backup generation. At the time of writing this article, cPanel's backup system looks explicitly for the following errors in the backup log to determine if a significant problem has occurred:
# awk -F'/' '/ERROR_PATTERNS =/,/]/ { if ($2) print $2; }' /usr/local/cpanel/bin/backup
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: Error
mysqldump: Couldn't
mysqldump failed
“Mysql” failed with an error
Failed to generate backup metadata
The following one-line script can be run as the root user via Terminal or SSH to search the backup logs as the backup system does. If the script produces no output, it means that no errors occurred during the backup runs. If the script has output, those errors within the backup log should be addressed.
awk -F'/' '/ERROR_PATTERNS =/,/]/ { if ($2) print $2; }' /usr/local/cpanel/bin/backup | while read ERROR;do grep --with-filename "$ERROR" /usr/local/cpanel/logs/cpbackup/*;done
Additional Information:
Backup errors can cause old backups to not be properly pruned. The following article explains the reasons in further detail:
Why won't cPanel delete ( prune ) old backups? - Why is my backup retention setting not enforced?
Comments
0 comments
Article is closed for comments.