From 6e5f4f485da27a0c907529d8a7e9ebaf662d5799 Mon Sep 17 00:00:00 2001 From: Alexander Overvoorde Date: Sat, 12 Oct 2019 12:35:16 +0200 Subject: [PATCH] Add proper handling of docker stop --- README.md | 2 ++ run.sh | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0fc5244..52f6cd9 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ docker run \ run ``` +**If you do this, then make sure to also run the import with the `openstreetmap-rendered-tiles` volume to make sure that caching works properly across updates!** + ### Enabling automatic updating (optional) Given that you've specified both the OSM data and polygon as specified in the *Automatic updates* section during server setup, you can enable the updating process by setting the variable `UPDATES` to `enabled`: diff --git a/run.sh b/run.sh index 38c2d0c..9522cdd 100755 --- a/run.sh +++ b/run.sh @@ -95,8 +95,16 @@ if [ "$1" = "run" ]; then /etc/init.d/cron start fi - # Run - sudo -u renderer renderd -f -c /usr/local/etc/renderd.conf + # Run while handling docker stop's SIGTERM + stop_handler() { + kill -TERM "$child" + } + trap stop_handler SIGTERM + + sudo -u renderer renderd -f -c /usr/local/etc/renderd.conf & + child=$! + wait "$child" + service postgresql stop exit 0