Skip to content

Instantly share code, notes, and snippets.

@sdesalas
Created December 19, 2023 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdesalas/21230d062a8ab902d66bd453d44a50d7 to your computer and use it in GitHub Desktop.
Save sdesalas/21230d062a8ab902d66bd453d44a50d7 to your computer and use it in GitHub Desktop.
Check Redis connectivity
#! /bin/bash
# @see https://stackoverflow.com/questions/33243121/abuse-curl-to-communicate-with-redis
# Without any tools
exec 3<>/dev/tcp/$REDIS_HOST/6379 && echo -e "PING\r\n" >&3 && head -c 7 <&3
# With netcat (apt install netcat-traditional)
(printf "PING\r\n";) | nc $REDIS_HOST 6379
# With telnet
telnet $REDIS_HOST 6379
> ping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment