mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 02:59:27 +08:00
Update check.sh
This commit is contained in:
@@ -10,6 +10,7 @@ if systemctl is-active --quiet "$service_name"; then
|
||||
# 检查是否存在僵尸进程
|
||||
zombie_processes=$(ps -ef | grep -i openresty | grep -v grep | awk '{print $2}' | xargs ps -o state= -p 2>/dev/null | grep -c Z)
|
||||
if [ "$zombie_processes" -gt 0 ]; then
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "检测到OpenResty僵尸进程,正在重启服务..."
|
||||
systemctl restart "$service_name"
|
||||
echo "服务已重启"
|
||||
@@ -17,6 +18,7 @@ if systemctl is-active --quiet "$service_name"; then
|
||||
echo "OpenResty运行正常"
|
||||
fi
|
||||
else
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "OpenResty未运行,正在启动服务..."
|
||||
systemctl start "$service_name"
|
||||
echo "服务已启动"
|
||||
|
||||
Reference in New Issue
Block a user