Created
September 20, 2015 03:14
-
-
Save Xion/624979b05e0411324eb1 to your computer and use it in GitHub Desktop.
Flush all keys from memcached server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -- | |
# Purge local memcache, flushing all the keys & values | |
set escapechar !; # easier to send than default ^] | |
set host [lindex $argv 1]; | |
if { ![string length $host] } { | |
set host "localhost"; | |
} | |
set port [lindex $argv 2]; | |
if { ![string length $port] } { | |
set port "11211"; | |
} | |
spawn telnet -e $escapechar "$host" $port; | |
expect "Connected to $host"; | |
send "flush_all\n"; | |
send $escapechar; | |
expect "telnet>"; | |
send "quit\n"; | |
wait; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment