GithubHelp home page GithubHelp logo

crony's Introduction

Build

crony

Simple docker cron job scheduler.

Features

  • Start existing docker container periodically
  • Send a mail after the job execution (always, or only on failure) with stdout/stderr
  • Automatically register new containers
  • healthchecks.io integration (job start/return code, duration)

Usage

Start crony with following docker-compose.yml

version: "2.1"
services:
  crony:
    image: ghcr.io/0xerr0r/crony:latest
    container_name: crony
    volumes:
      # needs access to host docker socket to read container labels and start job containers
      - /var/run/docker.sock:/var/run/docker.sock:ro
      # to synchronize the time zone with host
      - /etc/localtime:/etc/localtime:ro
    environment:
      # mail settings
      - SMTP_HOST=smtp.gmail.com 
      - SMTP_PORT=587
      - [email protected]
      - SMTP_PASSWORD=xxx
      - [email protected]
      - MAIL_FROM=CRONY <[email protected]>
      # global mail policy: always, never or onerror
      - MAIL_POLICY=always
      # optional: log level (one of trace, debug, info, warn, error, fatal), info is default if not set
      - LOG_LEVEL=info
    mem_limit: 30MB

Use following labels in your docker container which should be scheduled by crony:

...
      labels:
          # cron string
          - crony.schedule="*/15 6-23 * * *"
          # optional to override the global settings
          - crony.mail_policy=onerror
          # optional, use following job UUID for reporting to healthcheck.io
          - crony.hcio_uuid=394ed711-afca-4a4f-9cdb-16b7e976418e
...

crony's People

Contributors

0xerr0r avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

suryatmodulus

crony's Issues

Settings for anonymous SMTP

Currently there are no way to send email notification using a local SMTP server which requires no authentication.
Even setting-up enviroment variables SMTP_USER and SMTP_PASSWORD to empty values, the authentication occurs (and fail).

To send a mail without authentication you can use the gomail.Dialer class without the username and password parameter, as seen in https://pkg.go.dev/gopkg.in/gomail.v2#example-package-NoAuth

Currently SMTP user and password are mandatory parameters; consider to change these parameters to optional, or keep them mandatory but allow to set them to empty values and change the behaviour of the SendMail function accordingly.

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.