話不多說,直接上代碼
#!/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/zh-hant/jianzhanjiaoliu/2259.html