forked from chatchat-space/Langchain-Chatchat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
#! /bin/bash | ||
|
||
# mac设备上的grep命令可能不支持grep -P选项,请使用Homebrew安装;或使用ggrep命令 | ||
ps -eo pid,user,cmd|grep -P 'server/api.py|webui.py|fastchat.serve|multiprocessing'|grep -v grep|awk '{print $1}'|xargs kill -9 | ||
#ps -eo pid,user,cmd|grep -P 'server/api.py|webui.py|fastchat.serve|multiprocessing'|grep -v grep|awk '{print $1}'|xargs kill -9 | ||
|
||
# 使用ps和grep来查找相关进程,并将进程ID存储在变量中 | ||
pids=$(ps -eo pid,user,cmd | grep -P 'server/api.py|webui.py|fastchat.serve|multiprocessing' | grep -v grep | awk '{print $1}') | ||
|
||
# 检查是否找到了进程ID | ||
if [ -n "$pids" ]; then | ||
# 如果有进程ID,则执行kill命令 | ||
echo "Killing processes with IDs: $pids" | ||
kill $pids 2>/dev/null | ||
else | ||
# 如果没有找到进程ID,则输出提示信息 | ||
echo "No matching processes found to kill." | ||
fi |