title: Bitbucket Pipeline build never ends
body: <p>This is essentially the same issue as <a href="https://stackoverflow.com/questions/65764120/bitbucket-pipeline-ssh-doesnt-end">this individual</a></p>
  <p>I have a bitbucket pipeline file <code>bitbucket-pipelines.yml</code> which executes the file <code>deploy.sh</code> when a new commit is made to the <code>main</code> branch. <code>deploy.sh</code> in turn calls <code>pull.sh</code> which performs a set of actions:</p>
  <ol>
  <li>If it exists, kill the existing <code>refgator-api.py</code> process</li>
  <li>Change to the directory containing the repo</li>
  <li>Pull from the repo</li>
  <li>Change to the directory containing <code>refgator-api.py</code></li>
  <li>Execute <code>python3 refgator-api.py</code></li>
  </ol>
  <p>It's at this last step that my bitbucket pipeline will continue executing (consuming all my build minutes).</p>
  <p>Is there any way I can complete the bitbucket pipeline successfully after <code>pull.sh</code> has performed <code>python3 refgator-api.py</code>?</p>
  <h2>bitbucket-ipelines.yml</h2>
  <pre><code>image: atlassian/default-image:latest
  
  pipelines:
      default:
        - step:
            script:
                - cat ./deploy.sh | ssh -tt root@xxx.xxx.xxx.xxx
                - echo &quot;Deploy step finished&quot;
  </code></pre>
  <h2>deploy.sh</h2>
  <pre><code>echo &quot;Deploy Script Started&quot;
  cd
  sh pull.sh
  echo &quot;Deploy script finished execution&quot;
  </code></pre>
  <h2>pull.sh</h2>
  <pre><code>## Kills the current process which is restarted later
  kill -9 $(pgrep -f refgator-api.py)
  
  ## And change to directory containing the repo
  cd eg-api
  
  ## Pull from the repo
  export GIT_SSH_COMMAND=&quot;ssh -i ~/.ssh/id_rsa.pub&quot;
  GIT_SSH_COMMAND=&quot;ssh -v&quot; git pull git@bitbucket.org:myusername/myrepo.git
  
  ## Change to directory containing the python file to execute
  cd refgator-api
  python3 refgator-api.py &amp;
  
  </code></pre>