Advertisement
Russell

Directory Backup Bash Script

Jan 23rd, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. #!/bin/bash
  2. #Created by Russell John (https://russelljohn.net)
  3. #START
  4. TIME=`date +%b-%d-%y`                 # This command will add date in backup filename
  5. FILENAME=knack-$TIME.tar.gz           # Define backup filename format
  6. SRCDIR=/home/russell                  # Location of data directory (source of backup)
  7. DESDIR=/backup/russell                # Destination of backup file
  8.  
  9. tar -cpzf $DESDIR/$FILENAME $SRCDIR
  10.  
  11. find $DESDIR/* -mtime +5 -exec rm -rf {} \;
  12. #END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement