首页 > 解决方案 > 从 post-recieve 启动 python 文件

问题描述

我有这个接收后挂钩

#!/bin/bash
while read oldrev newrev ref
do
    # only checking out the master (or whatever branch you would like to deploy)
    if [[ $ref =~ .*/master$ ]];
    then
        echo "Master ref received.  Deploying master branch to production..."
        git --work-tree=/home/prod/app --git-dir=/home/prod/chat.git/ checkout -f
        killall python3 &
        python3 /home/prod/app/server/server.py &
    else
        echo "Ref $ref successfully received.  Doing nothing: only the master branch may be deployed on this server."
    fi
done

运行并检查正常,但 server.py 进程要么未启动,要么之后不会继续运行。有什么方法可以从钩子中启动 python 脚本并保持运行?

标签: pythongit

解决方案


推荐阅读