cPanel Backup via remote FTP -- This script will generate full cpbackup and then copy it to the remote ftp server. You can also use SCP as an alternate backup transfer method. Simply made the changes in transfer mode and the port no(i.e, MODE and PORT)
#!/bin/bash
#cPanel info -- host that is being backed up
CP_USERNAME=username
CP_PASSWORD=password
CP_DOMAIN=domainname or ip
CP_SKIN=x3 # plain "x" is probably the most common one
#FTP info -- host to receive the backup file
CP_FTP_USER=username
CP_FTP_PASS=password
CP_FTP_HOST=domainname or ip
PORT=port
# backup transfer mode
MODE=ftp
# email address for sending notification after backup is completed
CP_EMAIL=webmaster@example.com
# target directory on remote host; do not include domain names in this one
CP_FTP_BACKUP_ROOT=/home/$CP_FTP_USER
# initiate backup (the following command should be on one line)
curl --silent --insecure --user $CP_USERNAME:$CP_PASSWORD -d
"dest=$MODE&email;=$CP_EMAIL&server;=$CP_FTP_HOST&user;=$CP_FTP_USER&pass;=$CP_FTP_PASS&port;=$PORT&rdir;=$CP_FTP_BACKUP_ROOT"
https://$CP_DOMAIN:2083/frontend/$CP_SKIN/backup/dofullbackup.html > /dev/null
# gets curl return code
CURL_EXIT=$?
# curl encountered an error
if [ $CURL_EXIT -gt 0 ]; then
echo curl returned exit status $CURL_EXIT - see curl manual pages for more details
exit 69
fi
# everything ok
exit 0