Catch the TERM signal in the run_app_*paas scripts

When Cloud Foundry applications are to be rescheduled from one cell to
another, or they are stopped, they are sent a SIGTERM signal and 10
seconds later, a SIGKILL signal.

Currently the scripts trap the POSIX defined EXIT handler, rather than
the signal directly.

In order for the signal to properly be propagated to celery, and the
celery workers, the script should call the on_exit function when
receiving a TERM signal.

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Becca <rebecca.law@digital.cabinet.office.gov.uk>
Co-authored-by: Toby <toby.lornewelch-richards@digital.cabinet.office.gov.uk>
This commit is contained in:
Toby Lorne
2019-10-29 17:21:16 +00:00
parent ca96c5d81b
commit 4ad2e30e52
2 changed files with 2 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ echo "Run script pid: $$"
check_params
trap "on_exit" EXIT
trap "on_exit" EXIT TERM
configure_aws_logs

View File

@@ -143,7 +143,7 @@ echo "Run script pid: $$"
check_params
trap "on_exit" EXIT
trap "on_exit" EXIT TERM
configure_aws_logs