title: I want to automate my angular build using pos-receive in background process
body: <p>I want to automate my angular build using pos-receive and i want it to run in backgound process so I will not wait to finish the command.</p>
  
  <p>I tried the following the following code on my post-receive but it doesn't work.</p>
  
  <p><strong>post-receive</strong></p>
  
  <pre><code>#!/bin/bash
  git --work-tree=/var/www/my-sample-app.com --git-dir=/var/repo/my-sample-app.com.git checkout -f master
  cd /var/www/my-sample-app.com
  ng build --prod &gt;/dev/null 2&gt;&amp;1 &amp; 
  </code></pre>
  
  <p>I also tried to create a separate executable script on usr/local/bin directory like this</p>
  
  <p><strong>build-app-script</strong></p>
  
  <pre><code>#!/bin/bash
  cd /var/www/my-sample-app.com
  mkdir test-dir
  ng build --prod
  </code></pre>
  
  <p>then on my post-receive i change the code</p>
  
  <pre><code>ng build --prod &gt;/dev/null 2&gt;&amp;1 &amp; 
  </code></pre>
  
  <p>to</p>
  
  <pre><code>nohup /usr/local/bin/build-app-script &amp;&gt;/dev/null 2&gt;&amp;1 &amp;
  </code></pre>
  
  <p>the script seems working because it create a test-dir but the 
  ng-build --prod 
  command is not executing</p>
  
  <p>Any idea why is not working? or any suggestion. Thanks!</p>