daily pastebin goal
74%
SHARE
TWEET

Directory Backup Bash Script

Ekushey Jan 23rd, 2018 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top