3

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?

5

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

  • 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). – Tomasz 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
1

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 ) &

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.