Last active
March 8, 2022 09:39
-
-
Save Hassanzadeh-sd/91b8523e412bcde849ce3a8e77bc0031 to your computer and use it in GitHub Desktop.
backup from all migrations to zip files Usage: ./zip_migrations.sh app1 app2 app3 app4
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
set -o errexit | |
set -o pipefail | |
set -o nounset | |
working_dir="$(dirname ${0})" | |
GREEN='\033[01;32m' | |
echo -e "\e[37mINFO\e[0m: createing migration archives ..." | |
for f in "$@" | |
do | |
tar -cf $working_dir/00_migration_${f}.tar ${f}/migrations/*.py | |
done; | |
echo -e "\e[37mINFO\e[0m: compress all migrations to single file ..." | |
tar -cf $working_dir/full_backup_migrations_$(date +"%m_%d_%Y").tar $working_dir/00_migration_* | |
echo -e "\e[37mINFO\e[0m: remove extra tar files" | |
sudo rm $working_dir/00_migration_*.tar | |
echo -e "\e[32mSUCCESS\e[0m: your backup file is ready now :) in $working_dir/full_backup_migrations_$(date +"%m_%d_%Y").tar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment