I have a script, that I need to run after committing to a project under git revision control. Therefore I created a post-commit hook in my projects .git directory in the sub
You could also use the at
command. You may have to install it first
echo /path/to/your/executable | at now
OR:
echo bash /path/to/your/script | at now
See the at(1) manual page for more info about at (man at
or the online version)
Try to use nohup
#!/bin/sh
# I am a post-commit hook
nohup /usr/local/bin/my_script &
If you change #!/bin/sh
to #!/bin/bash
(assuming you're ok with using bash), and use nohup
, your example should work.
Here's how it works for me:
#!/bin/sh
# I am a post-commit hook
nohup /usr/local/bin/my_script &>/dev/null &