Created
October 12, 2020 13:36
-
-
Save umardx/ed00616c423d88844842ea2314bf7ad9 to your computer and use it in GitHub Desktop.
This file contains 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
#/bin/bash | |
echo "${DEPLOYMENT_TARGET_CSV}" | while IFS=, read -r serviceName serviceRole serviceCountry others;do | |
if [ -z "$serviceName" ] || [ -z "$serviceRole" ] || [ -z "$serviceCountry" ];then | |
continue | |
fi | |
QUERY="INSERT IGNORE INTO newton.deployment_target (service_name,role,country_abbrv) VALUES ('${serviceName}','${serviceRole}','${serviceCountry}');" | |
echo ">${QUERY}" | |
mysql --user="$mysql_user" --password="$mysql_password" --host="$mysql_host" -ss --execute="${QUERY}" > /dev/null 2>&1 | |
if [[ "$?" -ne 0 ]]; then | |
>&2 echo "[MYSQL ERROR] Failed connecting to MySQL host. Could be connection or user password problem. Exit code $exit_code" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment