My scenario is as follows: After updating files on my Git repository, I have a Git hook that calls an API from my web server. This API performs a Git pull and then I have a Git hook post-merge that restart the web server (Gunicorn). The restart of the web server should occurs a few seconds after the pull is completed otherwise the web server is shutting down before the API call is completed and that returns an error to the Git hook.
Currently I worked out the following solution but I am not happy with it.
The file
.git/hooks/post-merge
#!/bin/sh
/var/www/tempcollect/.git/hooks/restart > /var/www/tempcollect/.git/hooks/restart.log &
The file .git/hooks/restart
sleep 10s
/usr/bin/sudo systemctl restart tempcollect
I would prefer to have the command to restart the web server in the post-merge
file.
The execution of the file post-merge
is started by Git at the end of the pull, thus I have no control on the way it is started.
Asked by GuyOlivier
(31 rep)
Dec 23, 2020, 02:35 PM
Last activity: Dec 24, 2020, 10:12 AM
Last activity: Dec 24, 2020, 10:12 AM