话不多说,直接上代码
#!/bin/bash
while true
do
count=`netstat -tunple | grep 6379 | wc -l`
if [ 1 -gt $count ]; then
echo "Redis has stopped, restart..."
/etc/init.d/redis restart
sleep 1
else
#echo "Redis Run in system"
sleep 1
fi
done
然后在宝塔的定时任务里面设置一下定时就行了。
发布者:彬彬笔记,转载请注明出处:https://www.binbinbiji.com/jianzhanjiaoliu/2259.html