I want to push local changes to a live server, but the 'git-push' command does not terminate, after doing its' job. The program has to be stopped manually (I would like it to close itself).
I'm trying to use the git post-receive hook to update the live server and to restart two daemons. The problem is that the 'npm start' (the last command) continues to send its text output to 'git-push', even though 'npm start' was started as a background job. I've tried to redirect the stdin and sterr to /dev/null, but that didn't yield any result.
The 'npm start' starts a react web app
#!/bin/sh
killall node
GIT_WORK_TREE=/root/danskesn git checkout -f
server="node /root/danskesn/server/server.js"
webapp="npm start 1>/dev/null 2>&1 &"
nohup $server &
nohup $webapp &
My best guess is that the files that you are trying to update are being locked by your active (react web app) process and therefore the git push does not get a chance to resolve properly.