标签:cti klist .sh red cli lin pac bin UNC
#! /bin/bash
# sh redis_del_batch.sh . localhost 7000 redis7000 *blacklist*
function redis_del(){
local host port key_pattern
echo "begin delete redis key , host :" $2 ", port :" $3 ", key pattern :" $5 "......"
host=$2
port=$3
passwd=$4
key_pattern=$5
total_sum=0
$1/redis-cli -h ${host} -p ${port} -a ${passwd} --scan --pattern ${key_pattern} | while read LINE
do
echo "delete key : " $LINE
$1/redis-cli -h ${host} -p ${port} -a ${passwd} del $LINE
total_sum=$(($total_sum+1))
echo "del key num : " $total_sum
done
echo "finish delete redis key , host :" $2 ", port :" $3 ", key pattern :" $5 "......"
}
redis_del $1 $2 $3 $4 $5
Redis批量删除脚本
标签:cti klist .sh red cli lin pac bin UNC
原文地址:https://www.cnblogs.com/gjb724332682/p/10298018.html