I'm trying to execute a shell script that initialize the deployment of a web application after a git push. The shell script must be run as root ( or another user that is not the git user ).
Searching in SO I've found a way to launch a shell script as another user and is working for me when I launch it directly from the terminal:
sudo -u root sh /home/path/to/run.sh
The problem is that when I push to the server, the hook is launching ( I'm making sure that the post-receive program is running ), but the
run.sh program is not getting executed, and I don't any way to debug it...
Any clues?, what am I doing wrong?