Control Web Panel
WebPanel => Backup => Topic started 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.
-
+1
-
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.
#!/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
-
Perhaps the best copy to a remote FTP backups ready by CWP? It is easier and more standardized.
-
An FTP backup option would be a great addition to CentOSWP
-
Why we still donot have FTP backup in GUI? Script is so simple like Glenn write
-
Any update?