1502122468uvil 发表于 2019-12-17 14:15:41

[Webhook] 代码可以拉取 但是pm2无法重启服务



问题: 代码可以拉取 但是重启pm2 没有任何反应,pm2 restart xxx 也试过了





#!/bin/bash
echo ""
#输出当前时间
date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"
echo "Start"
#判断宝塔WebHook参数是否存在
if [ ! -n "$1" ];
then
          echo "param参数错误"
          echo "End"
          exit
fi
#git项目路径
gitPath="/www/wwwroot/hongbang"
#git 网址
gitHttp="git@"

echo "Web站点路径:$gitPath"

#判断项目路径是否存在
if [ -d "$gitPath" ]; then
      cd $gitPath
      #判断是否存在git目录
      if [ ! -d ".git" ]; then
                echo "在该目录下克隆 git"
                git clone $gitHttp gittemp
                mv gittemp/.git .
                rm -rf gittemp
      fi
      #拉取最新的项目文件
      git reset --hard origin/master
      git pull
      #重启node服务
      echo "重启 NODE Service"
      # pm2 show
      cd $gitPath
      pm2 startOrReload $gitPath/pm2.json
      #设置目录权限
      chown -R www:www $gitPath
      # pm2 restart hongbang
      echo "End"
      exit
else
      echo "该项目路径不存在"
      echo "End"
      exit
fi


宝塔用户_lkzupn 发表于 2022-11-28 19:18:00

我也无法重启pm2,最后你解决这个问题了吗?

huocto 发表于 2024-8-9 02:58:54

which pm2
#查询pm2路径
/查询的路径/pm2 restart hongbang
页: [1]
查看完整版本: [Webhook] 代码可以拉取 但是pm2无法重启服务