-
Notifications
You must be signed in to change notification settings - Fork 5k
[Bug][docker] Variable reference error in startup.sh #3894
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
*For better global communication, please give priority to using English description, thx! *
Please review https://dolphinscheduler.apache.org/en-us/docs/development/issue.html when describe an issue.
Describe the bug
in file docker/build/startup.sh , variables cannot reference in single quotes.
# start database
initDatabase() {
echo "test ${DATABASE_TYPE} service"
while ! nc -z ${DATABASE_HOST} ${DATABASE_PORT}; do
counter=$((counter+1))
if [ $counter == 30 ]; then
echo "Error: Couldn't connect to ${DATABASE_TYPE}."
exit 1
fi
echo "Trying to connect to ${DATABASE_TYPE} at ${DATABASE_HOST}:${DATABASE_PORT}. Attempt $counter."
sleep 5
done
echo "connect ${DATABASE_TYPE} service"
if [ ${DATABASE_TYPE} = "mysql" ]; then
v=$(mysql -h${DATABASE_HOST} -P${DATABASE_PORT} -u${DATABASE_USERNAME} --password=${DATABASE_PASSWORD} -D ${DATABASE_DATABASE} -e "select 1" 2>&1)
if [ "$(echo '${v}' | grep 'ERROR' | wc -l)" -eq 1 ]; then
echo "Error: Can't connect to database...${v}"
exit 1
fi
else
v=$(sudo -u postgres PGPASSWORD=${DATABASE_PASSWORD} psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USERNAME} -d ${DATABASE_DATABASE} -tAc "select 1")
if [ "$(echo '${v}' | grep 'FATAL' | wc -l)" -eq 1 ]; then
echo "Error: Can't connect to database...${v}"
exit 1
fi
fi
echo "import sql data"
${DOLPHINSCHEDULER_SCRIPT}/create-dolphinscheduler.sh
}To Reproduce
v="ERROR"
echo '${v}' | grep 'ERROR' | wc -l
Expected behavior
v="ERROR"
echo ${v} | grep 'ERROR' | wc -l
Screenshots
Which version of Dolphin Scheduler:
-[1.3.2-release]
-[dev]
Additional context
Add any other context about the problem here.
Requirement or improvement
- Please describe about your requirements or improvement suggestions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working