From 620eb7d386833ce74257143aaf28354e4d803819 Mon Sep 17 00:00:00 2001 From: smeb y <48400087+a3165458@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:42:48 +0800 Subject: [PATCH] Create Auto.sh --- Auto.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Auto.sh diff --git a/Auto.sh b/Auto.sh new file mode 100644 index 0000000..9e8f1b8 --- /dev/null +++ b/Auto.sh @@ -0,0 +1,16 @@ +#!/bin/bash +while true; do + # 检查node进程是否存在 + pgrep node > /dev/null + if [ $? -ne 0 ]; then + # 如果node进程不存在,输出信息并启动node + echo "Node进程未运行,正在尝试重新启动..." + GOEXPERIMENT=arenas go run ./... + echo "Node进程已启动。" + else + # 如果node进程正在运行,输出信息 + echo "Node进程已经在运行中。" + fi + # 每次检查后休眠10秒 + sleep 10 +done