github-actions[bot] commited on
Commit
7032382
·
1 Parent(s): 406bc5a

Update from GitHub Actions

Browse files
Files changed (1) hide show
  1. playbook.yml +6 -2
playbook.yml CHANGED
@@ -6,10 +6,14 @@
6
  app_port: 7860
7
  deploy_path: /root/workspace/cursor2api
8
 
 
 
 
 
9
  tasks:
10
  - name: 停止特定应用服务
11
  shell: |
12
- pid=$(ps -ef | grep "npm run start" | grep "{{ app_port }}" | grep -v grep | awk '{print $2}')
13
  if [ -n "$pid" ]; then
14
  echo "Stopping {{ app_name }} process with PID: $pid"
15
  kill -15 $pid
@@ -52,7 +56,7 @@
52
  cd {{ deploy_path }}
53
  test -f $HOME/.nvm/nvm.sh && source $HOME/.nvm/nvm.sh
54
  npm install
55
- PORT={{ app_port }} npm run start
56
  ' > {{ deploy_path }}/start.sh
57
  chmod +x {{ deploy_path }}/start.sh
58
  nohup {{ deploy_path }}/start.sh > {{ deploy_path }}/nohup.log 2>&1 &
 
6
  app_port: 7860
7
  deploy_path: /root/workspace/cursor2api
8
 
9
+ # root 1349786 1344741 0 10:32 pts/0 00:00:00 npm run start --host 0.0.0.0 --port 8888
10
+ # root 1349797 1349786 0 10:32 pts/0 00:00:00 sh -c node src/app.js --host 0.0.0.0 --port 8888
11
+ # root 1349798 1349797 0 10:32 pts/0 00:00:00 node src/app.js --host 0.0.0.0 --port 8888
12
+ # 查找进程id 排除掉"sh -c"以及"grep"的
13
  tasks:
14
  - name: 停止特定应用服务
15
  shell: |
16
+ pid=$(ps -ef | grep "node src/app.js" | grep -v "sh -c" | grep -v grep | grep "{{ app_port }}" | awk '{print $2}')
17
  if [ -n "$pid" ]; then
18
  echo "Stopping {{ app_name }} process with PID: $pid"
19
  kill -15 $pid
 
56
  cd {{ deploy_path }}
57
  test -f $HOME/.nvm/nvm.sh && source $HOME/.nvm/nvm.sh
58
  npm install
59
+ npm run start -- --host 0.0.0.0 --port {{ app_port }}
60
  ' > {{ deploy_path }}/start.sh
61
  chmod +x {{ deploy_path }}/start.sh
62
  nohup {{ deploy_path }}/start.sh > {{ deploy_path }}/nohup.log 2>&1 &