Last active
February 26, 2017 11:29
-
-
Save kopiro/e01a2f98adec6bc50bbfb6716216a235 to your computer and use it in GitHub Desktop.
S3 Backup in Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 0 2 1 * * /root/agent.sh | |
TIME=`date +%Y-%m-%d` | |
mkdir -p "/tmp/backup" | |
tar -cpzf "/tmp/backup/uploads.tar.gz" /var/www/uploads | |
tar -cpzf "/tmp/backup/other.tar.gz" /var/www/other | |
mysqldump -u root -p[PASS] [DBNAME] > "/tmp/backup/dump.sql" | |
aws s3 cp /tmp/backup "s3://[BUCKET]/backups/$TIME" --recursive | |
rm -rf /tmp/backup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment