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...") |
mNo edit summary |
||
| Line 1: | Line 1: | ||
<metadesc>An example of using expect in a bash script to check the state of redis. This is only a partial example of a complete script.</metadesc> | |||
Example of using expect within a bash script | 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. | This will give you both the hosts as well as an exit code to check for failures. | ||
Latest revision as of 15:03, 25 April 2024
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=$?