Post-receive script terminated after 54 seconds


After setting up a post-receive script I have noticed it is consistently terminated after 54 seconds. post-receive script:

echo "Started post-receive script" > "post_receive_log.txt"
for i in {1..120}
	echo "Running for $i seconds" >> "post_receive_log.txt"
	sleep 1

This outputs:

Running for 1 seconds
Running for 2 seconds
Running for 53 seconds
Running for 54 seconds

And stops at 54, instead of 119. Additionally, the GitLab server throws error: 4:Deadline Exceeded. as displayed:


Since I would like the post-receive script to run at least for 10 minutes, I tried increasing the worker limits in the /etc/gitlab/gitlab.rb file. In particular, I tried (independently and combined), to add the following changes:

gitlab_rails['max_request_duration_seconds'] = 570
gitlab_rails['env'] = {
gitlab_rails['application_settings_cache_seconds'] = 600
puma['worker_timeout'] = 600

Followed by a:

gitlab-ctl reconfigure
gitlab-ctl restart

However, the post-receive script is still being cut off after 54 seconds.


How can I allow the post-receive script to run for e.g. 2000 seconds?