check memcached status 1

check memcached status

echo stats | nc 203.0.113.12 11211

Here is what the above code is Doing:
1. We’re using the subprocess module to run the nc command.
2. We’re using the PIPE constant to tell subprocess to create a pipe to the
standard input of the nc command.
3. We’re using the communicate method to send the stats command to the
standard input of the nc command.
4. We’re using the communicate method to read the output of the nc command.
5. We’re printing the output of the nc command.

Similar Posts