Skip to content

Instantly share code, notes, and snippets.

@dennmart
Created April 20, 2010 16:50
Show Gist options
  • Save dennmart/372741 to your computer and use it in GitHub Desktop.
Save dennmart/372741 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Deleting dennmart.com archive for $(date +%A) if it exists..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -d -f dennmart.com-daily-$(date +%A)
echo "Creating dennmart.com archive for $(date +%A)..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -c -f dennmart.com-daily-$(date +%A) /var/www/dennmart.com
echo "Making temporary database dump..."
mysqldump -u root -pxxxxxx --all-databases --add-drop-table > /tmp/mysqldump.sql
echo "Deleting database dump archive for $(date +%A) if it exists..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -d -f mysqldump-daily-$(date +%A)
echo "Creating database dump archive for $(date +%A)..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -c -f mysqldump-daily-$(date +%A) /tmp/mysqldump.sql
echo "Deleting temporary database dump..."
rm -f /tmp/mysqldump.sql
#!/bin/bash
echo "Deleting dennmart.com archive if it exists..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -d -f dennmart.com-$(date +%B%Y)
echo "Creating dennmart.com archive for $(date +%B-%Y)..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -c -f dennmart.com-$(date +%B%Y) /var/www/dennmart.com
echo "Making temporary database dump..."
mysqldump -u root -pxxxxxx --all-databases --add-drop-table > /tmp/mysqldump.sql
echo "Deleting database dump archive if it exists..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -d -f mysqldump-$(date +%B%Y)
echo "Creating database dump archive for $(date +%B-%Y)..."
tarsnap --cachedir /usr/local/tarsnap-cache --keyfile /root/tarsnap.key -c -f mysqldump-$(date +%B%Y) /tmp/mysqldump.sql
echo "Deleting temporary database dump..."
rm -f /tmp/mysqldump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment