Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu commited on
Commit ·
aef3178
1
Parent(s): d535925
为Linux和macOS添加全自动运行脚本
Browse files- run_Linux.sh +8 -2
- run_macOS.command +8 -2
run_Linux.sh
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# 获取脚本所在目录
|
| 4 |
-
script_dir=$(dirname "$0")
|
| 5 |
|
| 6 |
# 将工作目录更改为脚本所在目录
|
| 7 |
-
cd "$script_dir"
|
| 8 |
|
| 9 |
# 检查Git仓库是否有更新
|
| 10 |
git remote update
|
|
@@ -23,3 +23,9 @@ if ! git status -uno | grep 'up to date' > /dev/null; then
|
|
| 23 |
# 重新启动服务器
|
| 24 |
nohup python3 ChuanhuChatbot.py &
|
| 25 |
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# 获取脚本所在目录
|
| 4 |
+
script_dir=$(dirname "$(readlink -f "$0")")
|
| 5 |
|
| 6 |
# 将工作目录更改为脚本所在目录
|
| 7 |
+
cd "$script_dir" || exit
|
| 8 |
|
| 9 |
# 检查Git仓库是否有更新
|
| 10 |
git remote update
|
|
|
|
| 23 |
# 重新启动服务器
|
| 24 |
nohup python3 ChuanhuChatbot.py &
|
| 25 |
fi
|
| 26 |
+
|
| 27 |
+
# 检查ChuanhuChatbot.py是否在运行
|
| 28 |
+
if ! pgrep -f ChuanhuChatbot.py > /dev/null; then
|
| 29 |
+
# 如果没有运行,启动服务器
|
| 30 |
+
nohup python3 ChuanhuChatbot.py &
|
| 31 |
+
fi
|
run_macOS.command
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# 获取脚本所在目录
|
| 4 |
-
script_dir=$(dirname "$0")
|
| 5 |
|
| 6 |
# 将工作目录更改为脚本所在目录
|
| 7 |
-
cd "$script_dir"
|
| 8 |
|
| 9 |
# 检查Git仓库是否有更新
|
| 10 |
git remote update
|
|
@@ -23,3 +23,9 @@ if ! git status -uno | grep 'up to date' > /dev/null; then
|
|
| 23 |
# 重新启动服务器
|
| 24 |
nohup python3 ChuanhuChatbot.py &
|
| 25 |
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# 获取脚本所在目录
|
| 4 |
+
script_dir=$(dirname "$(readlink -f "$0")")
|
| 5 |
|
| 6 |
# 将工作目录更改为脚本所在目录
|
| 7 |
+
cd "$script_dir" || exit
|
| 8 |
|
| 9 |
# 检查Git仓库是否有更新
|
| 10 |
git remote update
|
|
|
|
| 23 |
# 重新启动服务器
|
| 24 |
nohup python3 ChuanhuChatbot.py &
|
| 25 |
fi
|
| 26 |
+
|
| 27 |
+
# 检查ChuanhuChatbot.py是否在运行
|
| 28 |
+
if ! pgrep -f ChuanhuChatbot.py > /dev/null; then
|
| 29 |
+
# 如果没有运行,启动服务器
|
| 30 |
+
nohup python3 ChuanhuChatbot.py &
|
| 31 |
+
fi
|