(no title)
jamesralph8555 | 3 years ago
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"
No comments yet.