github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/redis/scripts/redis-sentinel-ping.sh (about) 1 #!/bin/sh 2 set -e 3 if [ ! -z "$SENTINEL_PASSWORD" ]; then 4 cmd="redis-cli -h localhost -p 26379 -a $SENTINEL_PASSWORD ping" 5 else 6 cmd="redis-cli -h localhost -p 26379 ping" 7 fi 8 response=$(timeout -s 3 $1 $cmd) 9 if [ $? -eq 124 ]; then 10 echo "Timed out" 11 exit 1 12 fi 13 if [ "$response" != "PONG" ]; then 14 echo "$response" 15 exit 1 16 fi