Return to Snippet

Revision: 1964
at December 1, 2006 11:20 by sudarkoff


Updated Code
#!/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/

Revision: 1963
at December 1, 2006 11:06 by sudarkoff


Initial Code
#!/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=txd_username HOME=/users/home/$USER USER_SS=strongspace_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/txd-backup/

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

Initial Description


Initial Title
Backup from textdrive to strongspace

Initial Tags
mysql, backup

Initial Language
Bash