Backup using compression and rsync
Posted: Thu Mar 06, 2014 11:11 am
Hi,
thanks for the great CP!
Would it be possible, to add compression and rsync to the backup script? Right now I have made a script myself to rsync /backup directory to remote server every morning at 7:30 via cron but would love to have it built-in not hack it to every server :)
If anyone needs it, here is my very simple script:
thanks for the great CP!
Would it be possible, to add compression and rsync to the backup script? Right now I have made a script myself to rsync /backup directory to remote server every morning at 7:30 via cron but would love to have it built-in not hack it to every server :)
If anyone needs it, here is my very simple script:
Code: Select all
#!/bin/bash
# BEGIN CONFIGURATION ==========================================================
BACKUP_DIR="/backup" # The directory in which you want backups placed
SYNC="rsync"
RSYNC_USER="username"
RSYNC_SERVER="xxx.xxx.xxx.xxx"
RSYNC_DIR="/remote/dir/$HOSTNAME/"
RSYNC_PORT="22" # Change this if you've customized the SSH port of your backup system
# You probably won't have to change these
THE_DATE="$(date '+%Y-%m-%d')"
RSYNC_PATH="$(which rsync)"
# END CONFIGURATION ============================================================
# Announce the backup time
echo "Backup Started: $(date)"
# Rsync everything with another server
echo "------------------------------------"
echo "Sending backups to backup server..."
$RSYNC_PATH --del --progress -vaze "ssh -p $RSYNC_PORT" $BACKUP_DIR/ $RSYNC_USER@$RSYNC_SERVER:$RSYNC_DIR
# Announce the completion time
echo "------------------------------------"
echo "Backup Completed: $(date)"