Git post-receive with gunicorn start,退出终端

时间:2018-01-21 01:55:43

标签: git bash gunicorn

我需要一些帮助,当我推送到我的git服务器时,我有这个收到后的代码:

#!/bin/bash
TRAGET="/var/www/app"
GIT_DIR="/opt/git/app.git"
BRANCH="master"

while read oldrev newrev ref
do
        # only checking out the master (or whatever branch you would like to deploy)
        if [[ $ref = refs/heads/$BRANCH ]];
        then
                echo "Reference $ref. Sending ${BRANCH} to production..."
                git --work-tree=$TRAGET --git-dir=$GIT_DIR checkout -f
                pkill gunicorn
                cd /var/www/app
                gunicorn run:app &
                cd -
        else
                echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
        fi
done

它正确推送并执行它应该做的所有事情,但它保留在下面的输出中,所以我需要按Ctrl + C离开它并转到终端。我认为它必须与gunicorn启动服务器做一些事情。

remote: [2018-01-21 03:44:05 +0200] [3023] [INFO] Starting gunicorn 19.7.1
remote: [2018-01-21 03:44:05 +0200] [3023] [INFO] Listening at: http://127.0.0.1:8000 (3023)
remote: [2018-01-21 03:44:05 +0200] [3023] [INFO] Using worker: sync
remote: [2018-01-21 03:44:05 +0200] [3028] [INFO] Booting worker with pid: 3028

我可以对代码执行某些操作,以便在推送后自动转到终端,因此我不必按^ C离开它。

0 个答案:

没有答案