Skip to content

Instantly share code, notes, and snippets.

@carlosjac
Created April 6, 2011 12:42
Show Gist options
  • Save carlosjac/905578 to your computer and use it in GitHub Desktop.
Save carlosjac/905578 to your computer and use it in GitHub Desktop.
backup transfer script
#!/bin/sh
# source directory containing files to transfer
LBDIR=/backups/daily.0
# destination directory
[email protected]:remotedirectory
#########################################################################
BACKUPDIR=`date +%A`
OPTS="--force --ignore-errors --delete -avz -e ssh"
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
# empty destination directory
[ -d $HOME/emptydir ] || mkdir $HOME/emptydir
rsync -e ssh --delete -a $HOME/emptydir/ $DBDIR/$BACKUPDIR/
rmdir $HOME/emptydir
# now the actual transfer
rsync $OPTS $LBDIR $DBDIR/$BACKUPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment