Control Web Panel

WebPanel => Backup => Topic started by: view on November 20, 2015, 01:20:59 PM

Title: FTP Backup
Post by: view on November 20, 2015, 01:20:59 PM
Hello

How to setup FTP/SFTP backup to remote backup FTP/SFTP server?
I see that you allow only rsync for remote backup.
Title: Re: FTP Backup
Post by: vdshub on December 22, 2015, 02:40:21 PM
+1
Title: Re: FTP Backup
Post by: Glenn on December 23, 2015, 07:39:55 AM
Hi not by default using the backup manager in CWP but you can do it via cron with a script, something like this , but you'll need to change it to your own liking.

Code: [Select]

#!/bin/bash
 
# FTP username and Pass
FTPUSER=ftpusername
FTPPASS=ftppassword
 
# this is a list of directories you want backed up. No trailing / needed.
INCLUDES="/home /var/www"
 
# I added a mysql user called backup with permissions to SELECT and LOCKING only for this backup
# CREATE USER backup@'localhost' IDENTIFIED BY 'backuppassword';
# GRANT SELECT,LOCKING ON *.* TO backup@'localhost'  WITH GRANT OPTION;
#
# change this variable to anything but 1 to disable mysql backups ( some prefer to backup the binlog )
MYSQLBACKUP=1
DBUSER=backup
DBPASS=backuppassword
 
TMPDIR=/tmp/backup
DAYOFWEEK=`date +%a`
DATESTAMP=`date +%d%m%y`
cd /
# remove all older files
rm -rf ${TMPDIR}/*
 
# create directory structure
/bin/mkdir -p ${TMPDIR}/files &&
/bin/mkdir -p ${TMPDIR}/db &&
/bin/mkdir -p ${TMPDIR}/archives &&
 
if [ $MYSQLBACKUP = 1 ];then
/usr/bin/mysqldump -u${DBUSER} -p${DBPASS} -A | gzip -c > ${TMPDIR}/db/mysql_backup-${DATESTAMP}-${DAYOFWEEK}.sql.gz
fi
 
for ITEMI in ${INCLUDES} ; do
/bin/mkdir -p ${TMPDIR}/files/${ITEMI}/
/usr/bin/rsync -aq ${ITEMI}/* ${TMPDIR}/files/${ITEMI}/
done
 
/bin/tar jcf ${TMPDIR}/archives/file-backup-${DATESTAMP}-${DAYOFWEEK}.tar.bz2 ${TMPDIR}/files/ > /dev/null 2>&1 &&
 
/usr/bin/lftp -u "${FTPUSER},${FTPPASS}" yourbackuplocation.com -e "set ftp:ssl-protect-data true; mrm *-${DAYOFWEEK}.* ; put ${TMPDIR}/archives/file-backup-${DATESTAMP}-${DAYOFWEEK}.tar.bz2; put ${TMPDIR}/db/mysql_backup-${DATESTAMP}-${DAYOFWEEK}.sql ; exit" >/dev/null
 
Title: Re: FTP Backup
Post by: vdshub on December 23, 2015, 08:37:29 PM
Perhaps the best copy to a remote FTP backups ready by CWP? It is easier and more standardized.

Title: Re: FTP Backup
Post by: batgranny on January 13, 2016, 09:37:51 AM
An FTP backup option would be a great addition to CentOSWP
Title: Re: FTP Backup
Post by: view on April 11, 2016, 08:32:10 PM
Why we still donot have FTP backup in GUI? Script is so simple like Glenn write
Title: Re: FTP Backup
Post by: view on May 19, 2016, 08:30:57 PM
Any update?