skip to Main Content

How can I set interval when repeating command several time in the interactive mode?

Like when I using redis-cli:

redis-cli -r 10 -i 1 PING

In interactive mode I can set amount of repeats before the command:

127.0.0.1:6379> 10 PING

But how can I set interval here?

2

Answers


  1. You can start redis-cli with the -i interval option:

    redis-cli -i 2
    127.0.0.1:6379> 2 PING
    

    However, in this case, all command will delay interval seconds, even if you don’t want to repeat the command.

    Login or Signup to reply.
  2. You may try

    for i in {1..10}; do redis-cli ping ; echo "running for $i th time"; sleep $i; done;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search