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?

# su -m user -c '/path/some_command -with -options /some/other/file'

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.