Giter VIP home page Giter VIP logo

docker-alpine-cron-pi's Introduction

docker-alpine-cron

Dockerfile and scripts for creating image with Cron based on Alpine
Installed packages: dcron wget rsync ca-certificates

Environment variables:

CRON_STRINGS - strings with cron jobs. Use "\n" for newline (Default: undefined)
CRON_TAIL - if defined cron log file will read to stdout by tail (Default: undefined)
By default cron running in foreground

Cron files

  • /etc/cron.d - place to mount custom crontab files

When image will run, files in /etc/cron.d will copied to /var/spool/cron/crontab.
If CRON_STRINGS defined script creates file /var/spool/cron/crontab/CRON_STRINGS

Log files

Log file by default placed in /var/log/cron/cron.log

Simple usage:

docker run --name="alpine-cron-sample" -d \
-v /path/to/app/conf/crontabs:/etc/cron.d \
-v /path/to/app/scripts:/scripts \
xordiv/docker-alpine-cron

With scripts and CRON_STRINGS

docker run --name="alpine-cron-sample" -d \
-e 'CRON_STRINGS=* * * * * root /scripts/myapp-script.sh'
-v /path/to/app/scripts:/scripts \
xordiv/docker-alpine-cron

Get URL by cron every minute

docker run --name="alpine-cron-sample" -d \
-e 'CRON_STRINGS=* * * * * root wget https://sample.dockerhost/cron-jobs'
xordiv/docker-alpine-cron

Docker Compose

version: '2'
services:
  cron:
    image: adrum/docker-alpine-cron-pi
    volumes:
      - ./crons:/etc/cron.d
      - ./scripts:/scripts
      - ./logs:/logs
    environment:
      - 'CRON_STRINGS=* * * * * root /scripts/myapp-script.sh'

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.