重启redis shell脚本

#!/bin/bash
ss -tnl | grep 6379

if [ $? -eq 0 ];then

ps -ef | grep redis | awk 'NR==1 {print $2}' | xargs kill -9 && nohup /usr/local/redis/redis-server /usr/local/redis/redis.conf > myout.file 2>&1 &

else

nohup /usr/local/redis/redis-server /usr/local/redis/redis.conf > myout.file 2>&1 &

fi

原文地址:https://www.cnblogs.com/MUQINGFENG123/p/13724798.html