How to make "nohup ./script.sh & disown" working in post-receive git hook?
If you want your script to detach itself, consider:
#!/bin/bash# ignore HUP signalstrap '' HUP# redirect stdin, stdout and stderr to/from /dev/nullexec >/dev/null 2>&1 <&1# run remaining content in a detached subshell( echo 'test' sleep 5) & disown
Alternately, you can perform these operations from the parent:
(trap '' HUP; ./yourscript &) >/dev/null <&1 2>&1 & disown