From 882ff255a87d7fca59fd794f414492ae29657a4f Mon Sep 17 00:00:00 2001 From: Stefan Peters Date: Tue, 13 Feb 2024 12:07:10 +0100 Subject: [PATCH] Adjust Docker image so that cronjobs are loaded from /config/cron --- docker/README.md | 4 +--- docker/docker-compose.yml | 2 -- docker/entrypoint.sh | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docker/README.md b/docker/README.md index af35335..cdd09f7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -25,8 +25,6 @@ services: - mongo volumes: - ./data/config:/config - # To run dumps on a schedule, you can define cronjobs with this file - # - ./data/cron:/etc/cron.d/cron - ./data/dumps:/usr/src/app/bartoc/data/dumps - ./data/reports:/usr/src/app/bartoc/data/reports environment: @@ -104,7 +102,7 @@ For more info about how to use these commands, please refer to [this section](ht **Note:** If local files are imported, these have to be mounted into the container first, and the path inside the container has to be given. For example, you could mount the host folder `./data/imports` to `/imports` inside the container and then use the path `/imports/myfile.ndjson` with the import command. ### Scheduled Dumps -Cron is configured inside the container to allow scheduled dumps. You can provide a cronfile by mounting it into `/etc/cron.d/cron`. Example cronfile: +Cron is configured inside the container to allow scheduled dumps. You can provide a cronfile by mounting it into `/config/cron`. Example cronfile: ```cron 00 04 * * * cd /usr/src/app/bartoc && npm run dump update > /proc/1/fd/1 2>/proc/1/fd/2 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 9787dbe..167eacb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,8 +9,6 @@ services: - mongo volumes: - ./data/config:/config - # To run dumps on a schedule, you can define cronjobs with this file - # - ./data/cron:/etc/cron.d/cron - ./data/dumps:/usr/src/app/bartoc/data/dumps - ./data/reports:/usr/src/app/bartoc/data/reports environment: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 4b44acb..6ee0680 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,8 +1,8 @@ #!/bin/bash -if [ -f /etc/cron.d/cron ]; then +if [ -f /config/cron ]; then echo "Found cron file, initializing crontab" - crontab /etc/cron.d/cron + crontab /config/cron crond start fi