Giter Club home page Giter Club logo

jobber-cron's Introduction

Dockerized Jobber Cron

Circle CI Docker Stars Docker Pulls Image Layers

Docker Container Cron Alternative With Jobber.

Supported tags and respective Dockerfile links

Bundle Version Tags Dockerfile Readme Example
Jobber latest latest Dockerfile Readme blacklabelops/jobber:latest
Jobber + Tools latest tools Dockerfile blacklabelops/jobber:tools
Jobber + Docker Tools latest docker Dockerfile Readme blacklabelops/jobber:docker
Jobber + AWS Cli latest aws Dockerfile Readme blacklabelops/jobber:aws
Jobber + GCE Cli latest gce Dockerfile Readme blacklabelops/jobber:gce

AWS = Amazon Web Services, GCE = Google Cloud Engine

Everything Altogether In One Image!

blacklabelops/cron-cloud

Make It Short!

In short, you can define periodic tasks for an arbitrary number of jobs.

Example:

$ docker run -d \
    --name jobber \
    -e "JOB_NAME1=TestEcho" \
    -e "JOB_COMMAND1=echo hello world" \
    blacklabelops/jobber

Will print "hello world" to console every second.

How It Works

The environment variables are numerated. Just add the number behind the environment variable and the container will create a job definition for Jobber!

This way the container can handle an arbitrary number of jobs without file handling or cumbersome syntax!

Example with two tasks:

$ docker run -d \
    --name jobber \
    -e "JOB_NAME1=TestEcho" \
    -e "JOB_COMMAND1=echo hello world" \
    -e "JOB_NAME2=TestEcho" \
    -e "JOB_COMMAND2=echo hello moon" \
    blacklabelops/jobber

First job will print "hello world" and then second job will print "hello moon" to console every second.

Environment Variables

Every job definition is specified by up to four environment variables:

  • JOB_NAME: The identifier for the job, must not contain empty spaces!
  • JOB_COMMAND: The bash command to be executed.
  • JOB_TIME: The cron schedule for the job. See Documentation
  • JOB_ON_ERROR: How Jobber should act on errors. Values: Stop, Backoff, Continue (Default). See Documentation

Full example:

$ docker run -d \
    --name jobber \
    -e "JOB_NAME1=TestEcho" \
    -e "JOB_COMMAND1=echo hello world" \
    -e "JOB_TIME1=1" \
    -e "JOB_ON_ERROR1=Backoff" \
    blacklabelops/jobber

Will print "hello world" in 1 second of every minute.

The Cron Time

When it comes to the cron string then Jobber is a little bit different. If you do not define any time then the resulting cron table will be

* * * * * *

and the job will be executed every second.

You can also define just one number "1". This will be interpreted as

1 * * * * *

so you can see that you have to specify the time string from the back and the rest will be filled up by Jobber.

As a reminder, cron timetable is like follows:

  1. Token: Second
  2. Token: Minute
  3. Token: Hour
  4. Token: Day of Month
  5. Token: Month
  6. Token: Day of Week

Vagrant

Vagrant is fabulous tool for pulling and spinning up virtual machines like docker with containers. I can configure my development and test environment and simply pull it online. And so can you! Install Vagrant and Virtualbox and spin it up. Change into the project folder and build the project on the spot!

$ vagrant up
$ vagrant ssh
[vagrant@localhost ~]$ cd /vagrant
[vagrant@localhost ~]$ docker-compose up

Type "docker logs jobber" in order to check the invocation.

Vagrant does not leave any docker artifacts on your beloved desktop and the vagrant image can simply be destroyed and repulled if anything goes wrong. Test my project to your heart's content!

First install:

References

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.