Apart from creating a 2nd script which would check the time of the last commit and then run the main script and which would be too complex of a solution, is there a simpler one?


Write a git post-commit hook that contains a call to at time+60

| improve this answer | |
  • what is "a call to at time+60"? – Oaemirami Jun 16 '18 at 16:26
  • 3
    @Oaemirami at is a command that executes another specified command at a given time (+60 seconds in this case). – user335605 Jun 16 '18 at 19:15
  • 1
    Why not just sleep 60 instead of using at? – jwodder Jun 16 '18 at 20:22
  • 2
    @jwodder Because that would block. – stark Jun 16 '18 at 21:07
  • The request was for script on "a server". If this is the host running the remote repo, this would be the post-receive hook. – John Mahowald Jun 17 '18 at 1:23

Besides at (which may or may not be available to the user under which the hook runs), you can also do something like that from the appropriate hook, probably post-receive):

( sleep 1m ; /usr/local/bin/do_something ) &
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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