Advertisement
Guest User

Untitled

a guest
Mar 31st, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.72 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Fileserver Backup Script
  4.  
  5.  
  6. #Yesterdays date in ISO-8601 format:
  7. DAY1=`ls /mnt/htmlephant/hostgator | tail -n 1`
  8.  
  9. #Todays date in ISO-8601 format:
  10. DAY0=`date -I`
  11.  
  12. mkdir -p /mnt/htmlephant/hostgator/hostgator_backup__$DAY0/home
  13.  
  14. for D in $(find /home/ -mindepth 1 -maxdepth 1 -type d) ; do
  15.  
  16.         #The source directory:
  17.         SRC="$D/public_html"
  18.  
  19.         #The target directory:
  20.         TRG="/mnt/htmlephant/hostgator/hostgator_backup__$DAY0$D"
  21.  
  22.         #The link destination directory:
  23.         LNK="/mnt/htmlephant/hostgator/$DAY1$D/public_html/"
  24.  
  25.         #The rsync options:
  26.         OPT="-avh --delete --link-dest=$LNK"
  27.  
  28.         echo rsync $OPT $SRC $TRG
  29.         rsync $OPT $SRC $TRG
  30. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement