Backup from textdrive to strongspace


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/bin/sh
  2. # backup script for textdrive to strongspace based on these articles:
  3. # http://help.textdrive.com/index.php?pg=kb.page&id=113
  4. # http://forum.textdrive.com/viewtopic.php?id=10126
  5.  
  6. # change this!
  7. USER=username
  8. HOME=/users/home/$USER
  9. USER_SS=username
  10. PWD_MYSQL=somepassword # chmod 700 this file
  11.  
  12. # Backup database
  13. # copy this line for more databases or use --all-databases if you are the main user
  14. # Don't forget to change the database name
  15. /usr/local/bin/mysqldump --opt --skip-add-locks --user=$USER --password=$PWD_MYSQL database1 | gzip > $HOME/backups/database1_`date "+%Y-%m-%d"`.gz
  16. /usr/local/bin/mysqldump --opt --skip-add-locks --user=$USER --password=$PWD_MYSQL database2 | gzip > $HOME/backups/database2_`date "+%Y-%m-%d"`.gz
  17.  
  18. # Backup subversion (Only works with FSFS)
  19. cd $HOME
  20. tar -z -c -f $HOME/backups/svn_`date "+%Y-%m-%d"`.tar.gz svn
  21.  
  22. # Add custom dirs here, if you need it, just like the svn example above
  23. # I just keep everything I need in subversion
  24.  
  25. # Delete old backups
  26. cd $HOME/backups/
  27. /usr/bin/find *.gz -mtime +8 -delete
  28.  
  29. # Send it to strongspace
  30. /usr/local/bin/rsync -azq --delete -e "ssh -i $HOME/.ssh/ss" $HOME/backups/*.gz $USER_SS@$USER_SS.strongspace.com:/home/$USER_SS/backup/txd_$USER/

URL: http://textsnippets.com/posts/show/587

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.