Guest User

Untitled

a guest
Mar 11th, 2013
84
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. #backup.sh
  3.  
  4. timestamp=`date "+%Y-%m-%d-%H-%M"`
  5. backupFS="/path/to/source/folder"
  6. backupTO=/path/to/destination/folder
  7. KeepTime=7
  8.  
  9. if [ -d $backupTO ];
  10. then
  11.  
  12. find $backupTO -maxdepth 1 -name \*.tar.gz -mtime +${KeepTime} -exec rm -f {} \;
  13.  
  14. for i in $backupFS
  15. do
  16.   j=`expr ${i//\//-}`
  17.   tar -zcvpf $backupTO/`hostname`.${timestamp}.${j}.tar.gz $i
  18.   echo "$i is done"
  19. done
  20. else
  21.   echo "backup directory is missing..exiting"
  22. exit 1
  23.  
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment