#Redis and connected clients

#!/bin/bash

HOST=$1
PORT=$2
PGNAME=`basename $0`

if (( $# < 2)); then
    echo "usage: $PGNAME host port"
    exit 55
fi

for hostn in echo $(redis-cli -h $HOST -p $PORT client list | cut -d ' ' -f2 | cut -d'=' -f 2 |  cut -d':' -f 1 | sort -u); 
do     
    echo "$hostn is $(host $hostn | cut -d' ' -f5)" ; 
done | grep -v NXDOMAIN | cut -d ' ' -f 1 | egrep -v '[0-9]{1,4}.[0-9]{1,4}.[0-9]{1,4}.[0-9]{1,4}' | sort -u
Advertisements

One thought on “#Redis and connected clients

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s