Author Topic: FTP Backup  (Read 17746 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
FTP Backup
« 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.

Offline
*
Re: FTP Backup
« Reply #1 on: December 22, 2015, 02:40:21 PM »
+1

Offline
**
Re: FTP Backup
« Reply #2 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
 

Offline
*
Re: FTP Backup
« Reply #3 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.


Offline
*
Re: FTP Backup
« Reply #4 on: January 13, 2016, 09:37:51 AM »
An FTP backup option would be a great addition to CentOSWP

Offline
*
Re: FTP Backup
« Reply #5 on: April 11, 2016, 08:32:10 PM »
Why we still donot have FTP backup in GUI? Script is so simple like Glenn write

Offline
*
Re: FTP Backup
« Reply #6 on: May 19, 2016, 08:30:57 PM »
Any update?