Author Topic: Empty MYSQL remote backups  (Read 1470 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Empty MYSQL remote backups
« on: December 03, 2019, 11:25:11 AM »
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?

Offline
*
Re: Empty MYSQL remote backups
« Reply #1 on: December 03, 2019, 12:18:14 PM »
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"
« Last Edit: December 06, 2019, 06:43:27 PM by Administrator »

Offline
*
Re: Empty MYSQL remote backups
« Reply #2 on: December 06, 2019, 12:57:11 AM »
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 :(
« Last Edit: December 06, 2019, 01:22:32 AM by Aalesund »

Offline
**
Re: Empty MYSQL remote backups
« Reply #3 on: December 09, 2019, 10:32:06 AM »
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.

Offline
**
Re: Empty MYSQL remote backups
« Reply #4 on: December 10, 2019, 04:10:56 PM »
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
Code: [Select]
#!/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.