GithubHelp home page GithubHelp logo

berendiwema / go-crond Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webdevops/go-crond

0.0 1.0 0.0 126 KB

:alarm_clock: Cron daemon written in golang (for eg. usage in docker images)

License: GNU General Public License v2.0

Makefile 15.77% Go 84.23%

go-crond's Introduction

go-crond

GitHub release license Build Status Github All Releases Github Releases

A cron daemon written in golang

Inspired by https://github.com/anarcher/go-cron

Using https://godoc.org/github.com/robfig/cron

Docker images

on Docker hub

  • webdevops/go-crond:alpine (based on alpine)
  • webdevops/go-crond:ubuntu (based on ubuntu:latest)
  • webdevops/go-crond:debian (based on debian:stable-slim)
  • webdevops/go-crond:{version}-alpine (based on alpine)
  • webdevops/go-crond:{version}-ubuntu (based on ubuntu:latest)
  • webdevops/go-crond:{version}-debian (based on debian:stable-slim)

Features

  • system crontab (with username inside)
  • user crontabs (without username inside)
  • run-parts support
  • Logging to STDOUT and STDERR (instead of sending mails)
  • Keep current environment (eg. for usage in Docker containers)
  • Supports Linux, MacOS, ARM/ARM64 (Rasbperry Pi and others)

Usage

Usage:
  go-crond [user:crontab] [user:crontab]…

Application Options:
      --default-user=       Default user (default: root)
      --include=            Include files in directory as system crontabs (with user)
      --auto                Enable automatic system crontab detection
      --run-parts=          Execute files in directory with custom spec (like run-parts; spec-units:ns,us,s,m,h; format:time-spec:path; eg:10s,1m,1h30m)
      --run-parts-1min=     Execute files in directory every beginning minute (like run-parts)
      --run-parts-15min=    Execute files in directory every beginning 15 minutes (like run-parts)
      --run-parts-hourly=   Execute files in directory every beginning hour (like run-parts)
      --run-parts-daily=    Execute files in directory every beginning day (like run-parts)
      --run-parts-weekly=   Execute files in directory every beginning week (like run-parts)
      --run-parts-monthly=  Execute files in directory every beginning month (like run-parts)
      --allow-unprivileged  Allow daemon to run as non root (unprivileged) user
  -V, --version             show version and exit
      --dumpversion         show only version number and exit
  -h, --help                show this help message
  -v, --verbose             verbose mode [$VERBOSE]
      --log.json            Switch log output to json format [$LOG_JSON]
      --server.bind=        Server address, eg. ':8080' (/healthz and /metrics for prometheus) [$SERVER_BIND]
      --server.metrics      Enable prometheus metrics (do not use senstive informations in commands -> use environment variables or files for storing these informations) [$SERVER_METRICS]

Crontab files can be added as arguments or automatic included by using eg. --include=crond-path/

Examples

Run crond with a system crontab:

go-crond examples/crontab

Run crond with user crontabs (without user in it) under specific users:

go-crond \
    root:examples/crontab-root \
    guest:examples/crontab-guest

Run crond with auto include of /etc/cron.d and script execution of hourly, weekly, daily and monthly:

go-crond \
    --include=/etc/cron.d \
    --run-parts-hourly=/etc/cron.hourly \
    --run-parts-weekly=/etc/cron.weekly \
    --run-parts-daily=/etc/cron.daily \
    --run-parts-monthly=/etc/cron.monthly

Run crond with run-parts with custom time spec:

go-crond \
    --run-parts=1m:/etc/cron.minute \
    --run-parts=15m:/etc/cron.15min

Run crond with run-parts with custom time spec and different user:

go-crond \
    --run-parts=1m:application:/etc/cron.minute \
    --run-parts=15m:admin:/etc/cron.15min

Installation

GOCROND_VERSION=20.7.0 \
&& wget -O /usr/local/bin/go-crond https://github.com/webdevops/go-crond/releases/download/$GOCROND_VERSION/go-crond-64-linux \
&& chmod +x /usr/local/bin/go-crond

Docker images

Image Description
webdevops/go-crond:latest Latest release, binary only
webdevops/go-crond:master Current development version in branch master

Metrics

go-crond exposes Prometheus metrics on :8080/metrics if enabled.

Metric Description
gocrond_task_info List of all cronjobs
gocrond_task_run_count Counter for each executed task
gocrond_task_run_result Last status (0=failed, 1=success) for each task
gocrond_task_run_time Last exec time (unix timestamp) for each task
gocrond_task_run_duration Duration of last exec

go-crond's People

Contributors

mblaschke avatar anarcher avatar christophlehmann avatar kumy avatar berendiwema avatar danielkucera avatar sergeyklay avatar

Watchers

James Cloos avatar

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.