-
Notifications
You must be signed in to change notification settings - Fork 7
Use pg-restore to restore directory one file dump #69
Conversation
checkPath AFTER_DOCKER_INIT_CODE | ||
if [ "$?" -ne "0" ]; then | ||
#>&2 echo "WARNING: Value given as after_db_init_code: '$AFTER_DOCKER_INIT_CODE' not found as file will use as content" | ||
echo "$AFTER_DOCKER_INIT_CODE" > $TMP_PATH/after_docker_init_code_tmp.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно было бы проще, без записи в файл — eval
echo "$AFTER_DOCKER_INIT_CODE" > $TMP_PATH/after_docker_init_code_tmp.sh | ||
AFTER_DOCKER_INIT_CODE="$TMP_PATH/after_docker_init_code_tmp.sh" | ||
else | ||
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as commands-after-docker-init will use as filename" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можешь обьяснить смысл сообщения? Не уверен, что правильно понял, зачем оно
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сообщение выводится только если включен режим отладки.
@@ -641,6 +655,7 @@ function cleanupAndExit { | |||
echo "$(date "+%Y-%m-%d %H:%M:%S"): Remove temp files..." # if exists | |||
docker $dockerConfig exec -i ${containerHash} sh -c "sudo rm -rf $MACHINE_HOME" | |||
rm -f "$TMP_PATH/after_db_init_code_tmp.sql" | |||
rm -f "$TMP_PATH/after_docker_init_code_tmp.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я думаю, что раз мы там плодим файлы, лучше удалять всю поддиректорию, только убедиться что имя уникальное
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*всю
docker_exec bash -c "chmod +x $MACHINE_HOME/$AFTER_DOCKER_INIT_CODE_FILENAME" | ||
docker_exec sh $MACHINE_HOME/$AFTER_DOCKER_INIT_CODE_FILENAME | ||
END_TIME=$(date +%s); | ||
DURATION=$(echo $((END_TIME-OP_START_TIME)) | awk '{printf "%d:%02d:%02d", $1/3600, ($1/60)%60, $1%60}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Заглавными буквами предполагалось именовать глобальные константы. А тут обычная переменная.
@@ -854,6 +882,8 @@ then | |||
fi | |||
OP_START_TIME=$(date +%s); | |||
echo "$(date "+%Y-%m-%d %H:%M:%S"): Restore database dump" | |||
#CPU_CNT=$(cat /proc/cpuinfo | grep processor | wc -l) | |||
CPU_CNT=$(docker_exec bash -c "cat /proc/cpuinfo | grep processor | wc -l") # for execute in docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да уж, это было совсем неправильно раньше :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Всё ок, несколько комментариев по стилю только, критичного ничего.
@@ -755,6 +764,8 @@ elif [[ "$RUN_ON" = "aws" ]]; then | |||
exit 1; | |||
fi | |||
echo "$(date "+%Y-%m-%d %H:%M:%S"): Docker $DOCKER_MACHINE is running." | |||
echo " To connect docker machine use:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хорошая идея :)
Use pg-restore to restore directory one file dump
No description provided.