Last active
September 1, 2023 15:03
-
-
Save stas-dovgodko/0b2861b3cbd08e8ca2b171f959a1dae5 to your computer and use it in GitHub Desktop.
Backup php craft cms to aws s3 and glacier
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 | |
mydir="$(dirname "$(readlink -f "$0")")" | |
php ${mydir}/craft backup --interactive=0 | |
backupfile="$(ls -Art "${mydir}/storage/backups/" | tail -n 1)" | |
now=`date +"%Y-%m-%d"` | |
tar cvzf ${mydir}/storage/runtime/temp/backup-${now}.tar.gz ${mydir}/storage/backups/${backupfile} ${mydir}/web/uploads/* | |
aws glacier upload-archive --account-id - --vault-name backups --body ${mydir}/storage/runtime/temp/backup-${now}.tar.gz | |
aws s3 cp ${mydir}/storage/runtime/temp/backup-${now}.tar.gz s3://myfancysitebacket-backups/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment