-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sigterm): amélioration de la gestion des SIGTERM (#60)
* chore(sigterm): forward SIGTERM to apache2 server (refs #59) * chore(sigterm): improve SIGTERM handling in loop-validate.sh to exit nicely and restart current validation (refs #59) * fix(sigterm): remove sleep added for debug purpose (refs #59) * fix(sigterm): add missing exec in application.sh and missing extension pcntl in docker image (refs #59) --------- Co-authored-by: Sylvain Lafay <sylvain.lafay@ign.fr>
- Loading branch information
Showing
7 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
|
||
while true | ||
RUNNING=1 | ||
|
||
_term(){ | ||
echo "$BASH_SOURCE - caught signal, terminating..." | ||
RUNNING=0 | ||
kill -s SIGTERM $child_pid | ||
wait | ||
} | ||
|
||
|
||
# Note that trapping SIGWINCH is due to weird usage of this "window resized" by apache2 | ||
# (see https://bz.apache.org/bugzilla/show_bug.cgi?id=50669) | ||
# ...propagated to STOPSIGNAL=SIGWINCH in php:8.2-apache docker image | ||
# ...which leads to an unexpected behavior of "docker stop" | ||
# ...and probably problems with PHP applications including console commands (Symfony, Laravel,...) | ||
trap _term SIGTERM SIGINT SIGWINCH | ||
|
||
echo "$BASH_SOURCE - started with PID=$$" | ||
|
||
while [ $RUNNING -eq 1 ] | ||
do | ||
php "${SCRIPT_DIR}/bin/console" ign-validator:validations:process-one -vv | ||
sleep 15 | ||
php "${SCRIPT_DIR}/bin/console" ign-validator:validations:process-one -vvv & | ||
child_pid=$! | ||
wait $child_pid | ||
|
||
if [ $RUNNING -eq 0 ]; | ||
then | ||
break; | ||
fi | ||
|
||
sleep 15 & | ||
child_pid=$! | ||
wait $child_pid | ||
done | ||
|
||
echo "$BASH_SOURCE - stopped" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters