Spaces:
Running
Running
github-actions[bot]
commited on
Commit
·
3718037
1
Parent(s):
be63dad
Update from GitHub Actions
Browse files- playbook.yml +16 -4
playbook.yml
CHANGED
@@ -5,12 +5,26 @@
|
|
5 |
- name: 停止旧服务
|
6 |
shell: |
|
7 |
pid=$(ps -ef | grep "uvicorn main:app" | grep -v grep | awk '{print $2}')
|
8 |
-
if [
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
fi
|
11 |
args:
|
12 |
executable: /bin/bash
|
13 |
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
- name: 复制到远程服务器
|
16 |
copy:
|
@@ -37,5 +51,3 @@
|
|
37 |
wait_for:
|
38 |
port: 7860
|
39 |
timeout: 30
|
40 |
-
|
41 |
-
|
|
|
5 |
- name: 停止旧服务
|
6 |
shell: |
|
7 |
pid=$(ps -ef | grep "uvicorn main:app" | grep -v grep | awk '{print $2}')
|
8 |
+
if [ -n "$pid" ]; then
|
9 |
+
echo "Stopping process with PID: $pid"
|
10 |
+
kill -15 $pid
|
11 |
+
sleep 3
|
12 |
+
if ps -p $pid > /dev/null 2>&1; then
|
13 |
+
echo "Force killing process with PID: $pid"
|
14 |
+
kill -9 $pid
|
15 |
+
fi
|
16 |
+
else
|
17 |
+
echo "No running process found"
|
18 |
fi
|
19 |
args:
|
20 |
executable: /bin/bash
|
21 |
ignore_errors: yes
|
22 |
+
|
23 |
+
- name: 确认服务已停止
|
24 |
+
wait_for:
|
25 |
+
port: 7860
|
26 |
+
state: stopped
|
27 |
+
timeout: 30
|
28 |
|
29 |
- name: 复制到远程服务器
|
30 |
copy:
|
|
|
51 |
wait_for:
|
52 |
port: 7860
|
53 |
timeout: 30
|
|
|
|