From 540734953b0d6caed625226c0c2b6af422b0fe7c Mon Sep 17 00:00:00 2001 From: "M.Goldshteyn" Date: Fri, 6 Sep 2024 11:09:50 +0300 Subject: [PATCH] backup name --- migration.sh | 19 +++++++++++-------- task.txt | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/migration.sh b/migration.sh index abdc69b..a67c6c7 100644 --- a/migration.sh +++ b/migration.sh @@ -1,6 +1,6 @@ #!/bin/bash - +#install sshpass if not installed if [ $(dpkg-query -W -f='${Status}' sshpass 2>/dev/null | grep -c "ok installed") -eq 0 ]; then apt update && apt-get install sshpass; @@ -41,7 +41,7 @@ send_backup() { else echo "no backup, nothing to send" && exit fi } -create_db() { +create_and_restore_db() { sed -e "s/DESTINATION_DB_NAME/${DESTINATION_DB_NAME}/" \ -e "s/DESTINATION_POSTGRES_PASSWORD/${DESTINATION_POSTGRES_PASSWORD}/"\ -e "s/DB_BACKUP/${DB_BACKUP}/"\ @@ -49,14 +49,17 @@ create_db() { sshpass -p "$DESTINATION_DATABASE_PASSWORD" ssh -p $DESTINATION_DATABASE_PORT $DESTINATION_DATABASE_USER@$DESTINATION_DATABASE_IP 'bash -s' < create_db.sh } -#restore_db(){ -# if [[ "$EVENT_STORE" == 0 ]] or [[ "$EVENT_STORE" == 1 ]]; then -# fi -#} +change_config(){ + sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "sed -i \"s|\(jdbc:postgresql://localhost:5432/\)[^?]*|\1${DESTINATION_DB_NAME}|g\" $DESTINATION_PLATFORM_PATH/conf/db.conf" +} db_backup send_backup -create_db -#restore_db +create_and_restore_db +change_config + + + + evt_full_rsync(){ echo "send $SOURCE_EVT to the destination" diff --git a/task.txt b/task.txt index 4ede29b..686e8c9 100644 --- a/task.txt +++ b/task.txt @@ -6,7 +6,7 @@ +5. Отправка его на удаленный сервер +6. Создание базы -7. Вотсановление дампа ++7. Вотсановление дампа 8. скачиванние платформы, ветку берем из конфига. фронт и бэк.