I use this script and the “expect” command line utility to purge Varnish caches on remote systems:

#!/usr/bin/expect
set 1 $argv
spawn telnet 192.168.1.99 6082
expect "Escape character is '^]'."
send "url.purge $1\n"
expect "200 0"
close

Cool, huh? Varnish is really great.

¥