New in CWP Edge-LatestFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers, and CWP Cage gives every user complete isolation. Available now in the CWP Edge-Latest version.

Get CWPpro ›

Empty MYSQL remote backups

Started by Aalesund, December 03, 2019, 11:25:11 AM

Previous topic - Next topic

Aalesund

I use remote backup but MYSQL backup has some bug.
All SQL files are empty.
Why?
Daily, Weekly and Monthly MYSQL backups (/cwp_remote/mysql/) are empty with size 0KB.

Any fix?

sva260

#1
i think your using new beta backup ?
if so , you should contact "support of centos-webpanel.com"
you using ssh or ftp ?
go to logs "corn backup"

Aalesund

#2
No, I use the old remote backup.
I had no problems with backups on CWP6, but I've reinstalled my vps with CentOS7 (CWP7) and now MYSQL backups doesn't works. The files backups of user accounts are fine, but mysql files are empty. Strange :/

I found that not only Remote mysql backup files are empty but the local backup mysql files in "backup" folder also are empty.

I don't know but this CWP7 can't backup any MYSQL files :(

ejsolutions

I've lost faith in the inbuilt backup- always has had bugs here & there. The ioncube encoded files are a joke!
Yesterday, I replicated the most important commands from the backup log onto a bash script, for a single user/domain and awaiting the cron job to run, in order to verify its' workings.

ejsolutions

Setup for one user/domain but fairly easily extendable. At present only backups the user's home dir, plus database and emails.
WTF is this not fully open-source for the benefit of others? Ioncube the backup script? Don't be dumb!

/root/custom-backup.sh
#!/bin/sh
username=user
domain=userdomain.com
#
tmp_dir=/home/tmp_bak/
backup_dir=/backup/custom/
retention=2
# --------------------
echo Custom Backup Job Starting
mkdir -p ${tmp_dir}${username}
echo copying home directory
ionice -c 3 nice -n +19 rsync -a /home/${username}/ ${tmp_dir}${username}
mkdir -p ${tmp_dir}${username}/mysql/
mysql --defaults-extra-file=/root/.my.cnf -e "show databases LIKE '${username}%';" | grep -v Database | while read databasename
do
     echo dumping $databasename
     mysqldump --defaults-extra-file=/root/.my.cnf "$databasename" > ${tmp_dir}${username}/mysql/"$databasename.sql" \
               2> ${tmp_dir}${username}/mysql/errors.txt

done
mkdir -p ${tmp_dir}${username}/vmail/
echo copying email
ionice -c 3 nice -n +19 cp -fR /var/vmail/${domain} ${tmp_dir}${username}/vmail/
echo consolidating files
cd ${tmp_dir}${username};ionice -c 3 nice -n +19 tar -cjf ${username}.tar.bz2 --exclude ${username}.tar.bz2 *
cd ${tmp_dir}${username};mv ${username}.tar.bz2 ${backup_dir}${username}-$(date -d "today" +"%Y%m%d%H%M").tar.bz2
echo cleaning up
/usr/bin/find ${backup_dir} -name "*.bz2" -mtime +${retention} -delete > /dev/null 2>&1
rm -Rf ${tmp_dir}${username}
echo Custom Backup Job Finished


Notes: I run this as a root cron task, followed half an hour later by another task which rsyncs the backup to a webDAV Nextcloud share.

Purelaise

Hi there

Do you have a script that backs up all users SQL daily? I dont require any file backups just SQL

Thank you