Wrote this simple one to create gzipped tar backups and send them over ssh.
A lot faster than rsync if you just need to back up a whole folder on a schedule.
It requires pigz, which is a parallel gzip implementation.
Variables:
$HOSTNAME - the computer hostname
$TOBACKUPDIR - the local directory you want backed up
$N_CORES - the number of cores you want to use for compression
$REMOTEUSER - the ssh user login on the remote server
$REMOTEHOST - the remote server's IP
$BACKUPDIR - where you want the file to be backed up to
#!/bin/bash
bfile=`date +%F`.$HOSTNAME.tar.gz
/usr/bin/tar cvpf - \
# You can exclude local directories here with
# --exclude="dir" \
$TOBACKUPDIR | pigz -p $N_CORES | \
ssh $REMOTEUSER@$REMOTEHOST "cat - > /$BACKUPDIR/$bfile"
Variables: $HOSTNAME - the computer hostname $TOBACKUPDIR - the local directory you want backed up $N_CORES - the number of cores you want to use for compression $REMOTEUSER - the ssh user login on the remote server $REMOTEHOST - the remote server's IP $BACKUPDIR - where you want the file to be backed up to
#!/bin/bash
bfile=`date +%F`.$HOSTNAME.tar.gz