2

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?

2 Answers 2

4

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

6
  • what is "a call to at time+60"?
    – Oaemirami
    Jun 16, 2018 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, 2018 at 19:15
  • 1
    Why not just sleep 60 instead of using at?
    – jwodder
    Jun 16, 2018 at 20:22
  • 2
    @jwodder Because that would block.
    – stark
    Jun 16, 2018 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. Jun 17, 2018 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 ) &

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .