ob_bulkstash: docker-compose w/ crond doesn’t stay running

running docker-compose up with the RCLONE_CRONFILE env var set doesn’t run, a perpetual command was needed to keep it running like command: tail -f /dev/null

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Alright, I have over simplified the minimum use case but it should be representative of the problem.

Here is docker-compose.yml

services:
  rclone:
    image: openbridge/ob_bulkstash
    environment:
     RCLONE_CRONFILE: /cron/crontab.conf
     RCLONE_SYNC_COMMAND: rclone version
    volumes:
     - /srv/rclone/crontab.conf:/cron/crontab.conf
    command: rclone version

And here is crontab.conf:

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/10 * * * * /usr/bin/env bash -c /rclone.sh run 2>&1

To me, the expected behavior is the following:

  • run rclone version as soon as the container start
  • run rclone version every 10 minutes through cron

But when running docker-compose up, here is the output:

reating network "tmp_default" with the default driver
Creating tmp_rclone_1 ... done
Attaching to tmp_rclone_1
rclone_1  | SHELL=/bin/bash
rclone_1  | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
rclone_1  | */10 * * * * /usr/bin/env bash -c /rclone.sh run 2>&1
rclone_1  | set daemon 10
rclone_1  | set pidfile /var/run/monit.pid
rclone_1  | set statefile /var/run/monit.state
rclone_1  | set httpd port 2849 and
rclone_1  |     use address localhost
rclone_1  |     allow localhost
rclone_1  | set logfile syslog
rclone_1  | set eventqueue
rclone_1  |     basedir /var/run
rclone_1  |     slots 100
rclone_1  | include /etc/monit.d/*
rclone_1  |  New Monit id: b92aca65e514c0ab1c39222b2d1018cf
rclone_1  |  Stored in '/root/.monit.id'
rclone_1  | Starting Monit 5.25.2 daemon with http interface at [localhost]:2849
rclone_1  | rclone v1.46
rclone_1  | - os/arch: linux/amd64
rclone_1  | - go version: go1.11.5
tmp_rclone_1 exited with code 0

As soon as rclone version as run, the container exits. It is just the version print but it could be any other rclone command that takes longer, this is just to simplify the testing and debugging. crond and monit are indeed running the background but only until docker-entrypoint.sh finishes executing. At that point docker assumes the container is done and stops it (as expected) which, in turn, also stops monit from managing crond inside the container.