加入杀死进程的脚本

This commit is contained in:
william 2024-09-18 14:26:20 +08:00
parent 8bd97382f0
commit 00ebdf2e3d
3 changed files with 16 additions and 1 deletions

View File

@ -11,6 +11,7 @@ steps:
- name: run - name: run
commands: commands:
- pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple -r requirements.txt - pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple -r requirements.txt
- pkill chyoso_toolkit_ui.py - chomd +x kill_ui.sh
- ./kill_ui.sh
- nohup python3 chyoso_toolkit_ui.py > output.log 2>&1 & - nohup python3 chyoso_toolkit_ui.py > output.log 2>&1 &
... ...

14
kill_ui.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# 使用 pgrep 查找进程 ID
pid=$(pgrep -f chyoso_toolkit_ui.py)
# 检查 pgrep 的返回值
if [ $? -eq 0 ]; then
# 如果找到进程,使用 kill 终止进程
kill $pid
echo "成功终止进程"
else
# 如果没有找到进程,返回 0
echo "没有找到进程"
fi