|
|
|
|
@ -14,8 +14,16 @@ DATE="$(date +%Y-%m-%d_%H-%M-%S)"
@@ -14,8 +14,16 @@ DATE="$(date +%Y-%m-%d_%H-%M-%S)"
|
|
|
|
|
echo $DATE |
|
|
|
|
|
|
|
|
|
#1. We are on the source (e.g. main) |
|
|
|
|
systemctl is-active --quiet platform5.service && systemctl stop platform5 |
|
|
|
|
systemctl is-active --quiet platform6.service && systemctl stop platform6 |
|
|
|
|
#systemctl is-active --quiet platform5.service && systemctl stop platform5 |
|
|
|
|
#systemctl is-active --quiet platform6.service && systemctl stop platform6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "PLATFORM_STATUS" == 1 ]]; then |
|
|
|
|
echo "echo PLATFORM_STATUS=$PLATFORM_STATUS" |
|
|
|
|
echo "Stopping $PLATFORM_SERVICE_NAME" |
|
|
|
|
systemctl stop $PLATFORM_SERVICE_NAME |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DB_BACKUP=$SOURCE_DB_NAME.migration.$DATE.sql |
|
|
|
|
echo "backup name:" $DB_BACKUP |
|
|
|
|
@ -52,8 +60,12 @@ create_and_restore_db() {
@@ -52,8 +60,12 @@ create_and_restore_db() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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" |
|
|
|
|
# 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" |
|
|
|
|
|
|
|
|
|
sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "sed -i \"s|\(jdbc:postgresql://[^:/]*:[0-9]*/\)[^?]*|\1${DESTINATION_DB_NAME}|g\" $DESTINATION_PLATFORM_PATH/conf/db.conf" |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
db_backup |
|
|
|
|
send_backup |
|
|
|
|
create_and_restore_db |
|
|
|
|
@ -100,11 +112,9 @@ fonts_rsync
@@ -100,11 +112,9 @@ fonts_rsync
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if systemctl cat platform5 >/dev/null 2>&1; then |
|
|
|
|
service platform5 start |
|
|
|
|
fi |
|
|
|
|
if systemctl cat platform6 >/dev/null 2>&1; then |
|
|
|
|
service platform6 start |
|
|
|
|
if [[ "PLATFORM_STATUS" == 1 ]]; then |
|
|
|
|
echo "start $PLATFORM_SERVICE_NAME" |
|
|
|
|
systemctl start $PLATFORM_SERVICE_NAME |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -113,3 +123,4 @@ fi
@@ -113,3 +123,4 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|