This is a quick post to show how one can issue commands to telnet session from a shell script or command line with out going into interactive mode. I use this to get stats from our memcache servers or issue a flush_all via telnet from a script/cron.
So without further delay, following command will telnet to local memcached server on port 11211 and issue one of the memcached commands, stats
(sleep .5;echo stats) | telnet localhost 11211
You may have to …