Fix config file path in redis healtcheck script

With I56767cb42a3cbe73242dddad2e6c00876e6ac448 we adapted THT to
use the new default path /etc/redis/redis.conf for the redis config file.

This commit adjusts the healtcheck script to cope with such change.

Change-Id: I309d8fa1f2c19c21ec1633f3d3ea37fcb8019275
This commit is contained in:
Luca Miccini 2022-09-15 07:23:09 +02:00
parent 437bb71e47
commit e375afe2fb

View File

@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
if parse_out=$(cat "/etc/redis.conf" | egrep "^bind +.*$"); then if parse_out=$(cat "/etc/redis/redis.conf" | egrep "^bind +.*$"); then
redis_host=$(echo -n $parse_out | awk '{print $2}') redis_host=$(echo -n $parse_out | awk '{print $2}')
else else
redis_host=127.0.0.1 redis_host=127.0.0.1
fi fi
if parse_out=$(cat "/etc/redis.conf" | egrep "^port +.*$"); then if parse_out=$(cat "/etc/redis/redis.conf" | egrep "^port +.*$"); then
redis_port=$(echo -n $parse_out | awk '{print $2}') redis_port=$(echo -n $parse_out | awk '{print $2}')
else else
redis_port=6379 redis_port=6379
fi fi
if parse_out=$(cat "/etc/redis.conf" | egrep "^requirepass +.*$"); then if parse_out=$(cat "/etc/redis/redis.conf" | egrep "^requirepass +.*$"); then
redis_pass=$(echo -n $parse_out | awk '{print $2}') redis_pass=$(echo -n $parse_out | awk '{print $2}')
result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port) result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port)
else else