Last active
April 4, 2022 02:57
-
-
Save icarrr/355979a7ede4540cafef88e61f392ccf to your computer and use it in GitHub Desktop.
This file contains 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 | |
set -e | |
localTime=$(date '+%Y%m%d_%H%M%S' -d "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')") | |
mkdir -p ~/backups/mongodb/dump-$localTime | |
mongodump --db edxapp --gzip -o ~/backups/mongodb/dump-$localTime -u 'admin' -p 'MONGO_ADMIN_PASSWORD' --authenticationDatabase admin | |
mongodump --db cs_comments_service --gzip -o ~/backups/mongodb/dump-$localTime -u 'admin' -p 'MONGO_ADMIN_PASSWORD' --authenticationDatabase admin | |
tar -C ~/backups/mongodb/ -cvpf ~/backups/mongodb/dump-$localTime.tgz dump-$localTime | |
rm -rf ~/backups/mongodb/dump-$localTime | |
echo "DONE" |
This file contains 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 | |
set -e | |
localTime=$(date '+%Y%m%d_%H%M%S' -d "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')") | |
mkdir -p ~/backups/mysql/backups-$localTime | |
mysqldump -u root --databases edxapp > ~/backups/mysql/backups-$localTime/edxapp_backup.sql | |
mysqldump -u root --databases edxapp_csmh > ~/backups/mysql/backups-$localTime/edxapp_csmh_backup.sql | |
tar -C ~/backups/mysql/ -cvpf ~/backups/mysql/backups-$localTime.tgz backups-$localTime | |
rm -rf ~/backups/mysql/backups-$localTime | |
echo "DONE" |
This file contains 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 | |
set -e | |
mongorestore --gzip --db 'edxapp' ~/backups/edxapp -u 'admin' -p 'MONGO_ADMIN_PASSWORD' --authenticationDatabase admin | |
mongorestore --gzip --db 'cs_comments_service' ~/backups/cs_comments_service -u 'admin' -p 'MONGO_ADMIN_PASSWORD' --authenticationDatabase admin |
This file contains 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 | |
set -e | |
mysql -u root -e "drop database edxapp;" | |
mysql -u root -e "drop database edxapp_csmh;" | |
mysql -u root -e "create database edxapp;" | |
mysql -u root -e "create database edxapp_csmh;" | |
mysql -u root edxapp < ~/extract-vania/name_backup/edxapp_backup.sql | |
mysql -u root edxapp < ~/extract-vania/name_backup/edxapp_csmh_backup.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment