Code Monkey home page Code Monkey logo

Comments (3)

willfarrell avatar willfarrell commented on May 29, 2024

Can you try with v0.6, see if that works.

from docker-crontab.

danobot avatar danobot commented on May 29, 2024

That doesn't work either.

Docker compose:


  crontab:
    # build: .
    image: willfarrell/crontab:0.6.0
    restart: always
    volumes:
     - "/var/run/docker.sock:/var/run/docker.sock:ro"
     - "${PWD}/config/config.yaml:/opt/crontab/config.yaml:ro"
     - "${PWD}/config-samples/config.sample.json:/opt/crontab/config.json:ro"
     - "${PWD}/logs:/var/log/crontab:rw"

Config.json

[
  {
    "comment": "map a volume",
    "schedule": "* * * * *",
    "dockerargs": "-d -v /tmp:/tmp",
    "command": "echo new",
    "image": "alpine:3.5"
  }
]

crontab_1    | 2021-01-01T10:41:21.552122125Z ##### crontab generation complete #####
crontab_1    | 2021-01-01T10:41:21.552632617Z # map a volume
crontab_1    | 2021-01-01T10:41:21.552646044Z * * * * * /bin/bash /opt/crontab/jobs/a37a44d3-fa7e-42a3-8067-e15dc0fe0273.sh
crontab_1    | 2021-01-01T10:41:21.552692428Z ##### run commands with onstart #####
crontab_1    | 2021-01-01T10:41:21.552767279Z crond -f -d 6 -c /etc/crontabs
crontab_1    | 2021-01-01T10:41:21.553190399Z crond: crond (busybox 1.31.1) started, log level 6
crontab_1    | 2021-01-01T10:42:00.553702943Z crond: USER docker pid  98 cmd /bin/bash /opt/crontab/jobs/a37a44d3-fa7e-42a3-8067-e15dc0fe0273.sh
crontab_1    | 2021-01-01T10:42:00.554789771Z Start Cronjob **a37a44d3-fa7e-42a3-8067-e15dc0fe0273** map a volume
crontab_1    | 2021-01-01T10:42:00.908710241Z 1f1b7b4b527ba926b4c9b33e1d7cbea932ebcd49190134db81db397904448bd5
crontab_1    | 2021-01-01T10:42:02.317511655Z End Cronjob **a37a44d3-fa7e-42a3-8067-e15dc0fe0273** map a volume
crontab_1    | 2021-01-01T10:43:00.554039511Z crond: USER docker pid 189 cmd /bin/bash /opt/crontab/jobs/a37a44d3-fa7e-42a3-8067-e15dc0fe0273.sh
crontab_1    | 2021-01-01T10:43:00.555075296Z Start Cronjob **a37a44d3-fa7e-42a3-8067-e15dc0fe0273** map a volume
crontab_1    | 2021-01-01T10:43:01.755776060Z dd678351875a1fd595a1460bd28f24fc6a6bfb97cfeffb5e9a1d2b174d8434ca
crontab_1    | 2021-01-01T10:43:04.093320629Z End Cronjob **a37a44d3-fa7e-42a3-8067-e15dc0fe0273** map a volume

The volume is mapped correctly and I can see the jobs.log file is getting created, but it is an empty file

from docker-crontab.

KinGsNowGH avatar KinGsNowGH commented on May 29, 2024

Same problem:

docker-compose:

  crontab01:
    image: willfarrell/crontab:1.0.0
    container_name: crontab01
    # environment:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      # - ./env:/opt/env:ro
      # - ./docker-compose-crontab/opt/crontab:/opt/crontab:rw
      - ./docker-compose-crontab/opt/crontab/config.yml:/opt/crontab/config.yml:rw
      # - ./crontab01-docker/var/log/crontab:/var/log/crontab:rw
    restart: always
    # healthcheck:
    network_mode: none
    # networks:
    # command:

config.yml

redmine_plugin_recurring_task:
  command: sh -c 'cd /home/redmine/redmine && RAILS_ENV=production bundle exec rake redmine_recurring_tasks:exec'
  comment: redmine_plugin_recurring_task
  container: redmine01
  # project: docker-compose-redmine
  schedule: '@every 1m'

Logs

2021-02-03T13:20:24.664390515Z ##### crontab generation complete #####
2021-02-03T13:20:24.665872468Z # redmine_plugin_recurring_task
2021-02-03T13:20:24.665918845Z */1 * * * * /bin/bash /opt/crontab/jobs/810847fb-441a-439c-9885-e3c04e59e7e9.sh
2021-02-03T13:20:24.666450460Z ##### run commands with onstart #####
2021-02-03T13:20:24.666786865Z crond -f -d 6 -c /etc/crontabs
2021-02-03T13:20:24.668117210Z crond: crond (busybox 1.31.1) started, log level 6
2021-02-03T13:21:00.670243017Z crond: USER docker pid 138 cmd /bin/bash /opt/crontab/jobs/810847fb-441a-439c-9885-e3c04e59e7e9.sh
2021-02-03T13:21:00.674956752Z Start Cronjob **810847fb-441a-439c-9885-e3c04e59e7e9** redmine_plugin_recurring_task
2021-02-03T13:21:12.226642170Z End Cronjob **810847fb-441a-439c-9885-e3c04e59e7e9** redmine_plugin_recurring_task

I tought i had a problem with volumes, but inside the container i still dont get any log:

bash-5.0# pwd
/var/log/crontab
bash-5.0# cat jobs.log
bash-5.0#

from docker-crontab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.