Commit 27e4f77f authored by iv's avatar iv

gitlab: watcher should take care of sidekiq killed by SIGTERM

The watcher should also watch for signals like SIGTERM killing sidekiq, which
are trapped by sidekiq, with sidekiq exiting successfully (with exit code 0).

Discussion: https://lab.nexedi.com/lab.nexedi.com/lab.nexedi.com/issues/25#note_22085
parent 5f488f42
...@@ -269,7 +269,7 @@ context = ...@@ -269,7 +269,7 @@ context =
[watcher-sigkill] [watcher-sigkill]
<= binsh <= binsh
md5sum = 2986dcb006dc9e8508ff81f646656131 md5sum = 9233f3726a8e7ee39cdfefa10d839c62
[gitlab-export] [gitlab-export]
<= binsh <= binsh
......
...@@ -12,6 +12,7 @@ fi ...@@ -12,6 +12,7 @@ fi
prog="$@" prog="$@"
progpid="" progpid=""
exitok="0" # sidekiq traps some signals (SIGTERM, ...) and exits with code 0
killexit="137" # = 128 + 9 (exit code of process terminated by SIGKILL) killexit="137" # = 128 + 9 (exit code of process terminated by SIGKILL)
# make sure to terminate children, when we exit. # make sure to terminate children, when we exit.
...@@ -33,7 +34,7 @@ while true; do ...@@ -33,7 +34,7 @@ while true; do
echo "-> $status" echo "-> $status"
# if program terminated not by SIGKILL - exit # if program terminated not by SIGKILL - exit
if [ "$status" != "$killexit" ] ; then if [[ "$status" != "$killexit" && "$status" != "$exitok" ]] ; then
echo "exit $status" echo "exit $status"
exit "$status" exit "$status"
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment