2020-09-15 17:48:28 +00:00
|
|
|
#!/bin/bash
|
2021-12-13 16:24:15 +00:00
|
|
|
set -e
|
2020-09-15 17:48:28 +00:00
|
|
|
|
2021-12-13 16:24:15 +00:00
|
|
|
get_key() {
|
2021-12-17 08:25:46 +00:00
|
|
|
jq -r ".$1" /home/frappe/frappe-bench/sites/common_site_config.json
|
2021-06-21 17:26:05 +00:00
|
|
|
}
|
|
|
|
|
2021-12-13 16:24:15 +00:00
|
|
|
get_redis_url() {
|
|
|
|
URL=$(get_key "$1" | sed 's|redis://||g')
|
|
|
|
if [[ ${URL} == *"/"* ]]; then
|
|
|
|
URL=$(echo "${URL}" | cut -f1 -d"/")
|
|
|
|
fi
|
|
|
|
echo "$URL"
|
|
|
|
}
|
2020-10-06 09:13:36 +00:00
|
|
|
|
2021-12-13 16:24:15 +00:00
|
|
|
check_connection() {
|
|
|
|
echo "Check $1"
|
|
|
|
wait-for-it "$1" -t 1
|
|
|
|
}
|
2020-09-15 17:48:28 +00:00
|
|
|
|
2021-12-13 16:24:15 +00:00
|
|
|
check_connection "$(get_key db_host):$(get_key db_port)"
|
|
|
|
check_connection "$(get_redis_url redis_cache)"
|
|
|
|
check_connection "$(get_redis_url redis_queue)"
|
|
|
|
check_connection "$(get_redis_url redis_socketio)"
|
2020-09-15 17:48:28 +00:00
|
|
|
|
2021-12-13 16:24:15 +00:00
|
|
|
if [[ "$1" = -p || "$1" = --ping-service ]]; then
|
|
|
|
check_connection "$2"
|
2020-09-15 17:48:28 +00:00
|
|
|
fi
|