Você tentou usar algumas das opções de tempo de ncat
? Aqui está o trecho relevante do evento de man ncat(1)
.
TIMING OPTIONS
These options accept a time parameter. This is specified in seconds by default, though you can append ms, s, m, or h to the value to specify milliseconds, seconds, minutes, or hours. -d time, --delay time (Specify line delay) . Set the delay interval for lines sent. This effectively limits the number of lines that Ncat will send in the specified period. This may be useful for low-bandwidth sites, or have other uses such as coping with annoying iptables --limit options. -i time, --idle-timeout time (Specify idle timeout) . Set a fixed timeout for idle connections. If the idle timeout is reached, the connection is terminated. -w time, --wait time (Specify connect timeout) . Set a fixed timeout for connection attempts.
Então, na sua situação, você executaria echo 'flush_all' | ncat -i 10s localhost 11211
.