Bash-check-redis-replication: Difference between revisions
Jump to navigation
Jump to search
(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...") |
(No difference)
|
Revision as of 15:20, 15 October 2021
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=$?