/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh # backup script for textdrive to strongspace based on these articles: # http://help.textdrive.com/index.php?pg=kb.page&id=113 # http://forum.textdrive.com/viewtopic.php?id=10126 # change this! USER=username HOME=/users/home/$USER USER_SS=username PWD_MYSQL=somepassword # chmod 700 this file # Backup database # copy this line for more databases or use --all-databases if you are the main user # Don't forget to change the database name /usr/local/bin/mysqldump --opt --skip-add-locks --user=$USER --password=$PWD_MYSQL database1 | gzip > $HOME/backups/database1_`date "+%Y-%m-%d"`.gz /usr/local/bin/mysqldump --opt --skip-add-locks --user=$USER --password=$PWD_MYSQL database2 | gzip > $HOME/backups/database2_`date "+%Y-%m-%d"`.gz # Backup subversion (Only works with FSFS) cd $HOME tar -z -c -f $HOME/backups/svn_`date "+%Y-%m-%d"`.tar.gz svn # Add custom dirs here, if you need it, just like the svn example above # I just keep everything I need in subversion # Delete old backups cd $HOME/backups/ /usr/bin/find *.gz -mtime +8 -delete # Send it to strongspace /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