Skip to content

Instantly share code, notes, and snippets.

@lucien144
Last active September 10, 2018 13:09
Show Gist options
  • Save lucien144/5dd948ad65924f940bc0f557c1071485 to your computer and use it in GitHub Desktop.
Save lucien144/5dd948ad65924f940bc0f557c1071485 to your computer and use it in GitHub Desktop.
MySQL backup using s3cmd & automysqlbackup
#!/bin/bash
apt-get install automysqlbackup
apt-get install s3cmd
s3cmd --configure
s3cmd sync --recursive --delete-removed /var/lib/automysqlbackup/ s3://bucket/mysql/
s3cmd sync --exclude-from=/root/s3cmd.exclude --recursive --delete-removed /sites s3://bucket/sites/daily/`echo $(date +"%F")`/
find /var/lib/automysqlbackup/ -name *.sql.gz -mtime +7 -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment