Redis停止後自動重啟解決方案

話不多說,直接上代碼

#!/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

(0)
彬彬筆記彬彬筆記
上一篇 2021年7月14日
下一篇 2021年11月4日

相關推薦

發表回復

登錄後才能評論
蜀ICP備14017386號-13