Last active
April 20, 2020 01:17
-
-
Save varokas/985f736d4802db855f9d5f1376d125b6 to your computer and use it in GitHub Desktop.
Ghost Daily Backup
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/bash | |
| current_date=`date +%Y%m%d` | |
| mysql_backup_filename="mysql-"$current_date | |
| mysql_backup_filename_gz=$mysql_backup_filename".gz" | |
| content_backup_filename="content-"$current_date".tar.gz" | |
| tar -C /home/ubuntu -czf /home/ubuntu/$content_backup_filename ghost | |
| /usr/local/bin/docker-compose -f /home/ubuntu/docker-compose.yml exec db /usr/bin/mysqldump -u root --password=<some_password> ghost > /home/ubuntu/$mysql_backup_filename | |
| gzip -f /home/ubuntu/$mysql_backup_filename | |
| aws s3 --profile backup cp /home/ubuntu/$content_backup_filename s3://ghost-varokas-com-backup/daily-backup/$content_backup_filename | |
| aws s3 --profile backup cp /home/ubuntu/$mysql_backup_filename_gz s3://ghost-varokas-com-backup/daily-backup/$mysql_backup_filename_gz | |
| rm /home/ubuntu/$content_backup_filename | |
| rm /home/ubuntu/$mysql_backup_filename_gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment