Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Backup from textdrive to strongspace (See related posts)

# backup script for textdrive to strongspace based on these articles:

# change this!
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/txd-backup/

You need to create an account or log in to post comments to this site.

Related Posts