From 52cee8b5b8e5a370b1e318879dbc45f044987d07 Mon Sep 17 00:00:00 2001 From: Franklin-F Date: Tue, 10 Jun 2025 21:17:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96kill=5Fmain.sh?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=BB=A5=E4=BD=BF=E7=94=A8pgrep=E6=9B=BF?= =?UTF-8?q?=E4=BB=A3ps=E5=91=BD=E4=BB=A4=E6=9F=A5=E6=89=BE=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kill_main.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/kill_main.sh b/kill_main.sh index 24ee028..2dc0bb7 100644 --- a/kill_main.sh +++ b/kill_main.sh @@ -6,13 +6,7 @@ TARGET="/opt/ql/DailyMotion/main.py" # 关键字:精确到脚本路径即可 SIG="9" # 信号;默认 -9,想温和一点改成 15 # -------------------------------- - -pids=$(ps -eo pid,cmd | grep "$TARGET" | grep -v grep | awk '{print $1}') - -ppids=$(printf "%s\n" $pids | xargs -r ps -o ppid= -p | tr -s ' \n') - -# 合并并去重 -all=$(printf "%s\n%s\n" "$pids" "$ppids" | sort -u | tr '\n' ' ') +pids=$(pgrep -f "$TARGET") if [ -z "$all" ]; then echo "没有发现正在运行的 $TARGET"