jasteele123

concrete5 Site Zip Backups

Jun 1st, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.02 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Backup a concrete5 site into 2 archives (excluding the core)
  4. #  A zip for files and a zip for everything else)
  5. #
  6. # John Steele - http://www.steelesoftconsulting.com/
  7. #
  8. # Change these 3 to reflect your environment:
  9.  
  10. DIR=c5dev
  11. C5="$HOME/c5dev"
  12. BACKDIR="$HOME/backup"
  13.  
  14. mkdir -p $BACKDIR       # creates it if it doesn't exist yet
  15. cd $C5
  16.  
  17. NICE="$(which nice)"
  18. ZIP="$(which zip)"
  19.  
  20. DATE=`date +%F`         # DATE=`date +%m-%d-%y`
  21. FARC="$BACKDIR/$DIR"_files_"$DATE".zip
  22. CARC="$BACKDIR/$DIR"_dir_"$DATE.zip"
  23.  
  24.         # some cleanup
  25. rm -f files/cache/tmp/*
  26. rm -f files/cache/zend_cache*
  27. rm -f $FARC
  28. rm -f $CARC
  29.  
  30.         # create the zip archive of files/ (with exclusions)
  31. $NICE $ZIP -qyr $FARC files \
  32.   -x "files/cache/*" "files/tmp/*" "files/trash/*" \
  33.   -x "files/backups/*"          # you may want to comment this line
  34.  
  35. cd ..
  36.         # archive the rest
  37. $NICE $ZIP -qyr $CARC $DIR \
  38.   -x "$DIR/concrete/*" "$DIR/files/*"
  39.  
  40.         # optional, change permissions to only owner
  41. chmod go-rw $FARC $CARC
Advertisement
Add Comment
Please, Sign In to add comment