Bash-check-redis-replication

From I Will Fear No Evil
Revision as of 16:20, 15 October 2021 by Chubbard (talk | contribs) (Created page with "Example of using expect within a bash script This will give you both the hosts as well as an exit code to check for failures. <pre> SLAVED_HOSTS=`exec expect <<EOD set timeou...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Example of using expect within a bash script This will give you both the hosts as well as an exit code to check for failures.

SLAVED_HOSTS=`exec expect <<EOD
set timeout 10
set send_slow {1 .3}
spawn telnet localhost ${PORT}
expect "Escape character is '^]'."
send "auth ${USER}\r"
expect "+OK"
send "info replication\r"
expect ">$"
send "quit\r"
EOD`
RESULT=$?