tripleo-common/healthcheck/memcached
Cédric Jeanneret ee419b6e9c Silent memcached healthcheck
Output only error, and exit with the right code.

Change-Id: Ia9c67e4b153d67963969a66a88c75e5346fc94d2
Closes-Bug: #1821778
2019-03-27 08:51:15 +01:00

12 lines
278 B
Bash
Executable File

#!/bin/bash
listen_addr=$(awk 'match($0, /-l +([0-9a-fA-F\.\:]+) /, a) {print a[1]}' /etc/sysconfig/memcached)
# Add brackets if IPv6
if [[ $listen_addr =~ ":" ]]; then
listen_addr="[${listen_addr}]"
fi
echo "version" | socat - TCP:$listen_addr:11211 1>/dev/null
exit $?