Created
          April 6, 2011 12:42 
        
      - 
      
 - 
        
Save carlosjac/905578 to your computer and use it in GitHub Desktop.  
    backup transfer script
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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