whatisgithub

What is cron?

robfig/cron — explained in plain English

Analysis updated 2026-06-24

14,124GoAudience · developerComplexity · 2/5Setup · easy

In one sentence

A Go library that lets your program run functions on a schedule using cron-style timing strings, like 'every hour' or 'midnight on Fridays', without relying on the operating system's cron tool.

Mindmap

mindmap
  root((robfig/cron))
    What it does
      Schedule Go functions
      Cron expressions
      No OS dependency
    Schedule formats
      Standard cron format
      Optional seconds field
      Per-schedule timezones
    Job wrappers
      Panic recovery
      Skip if running
      Delay if running
      Logging
    Setup
      Go 1.11 or later
      go get install
      Import and use
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Schedule a Go function to run every hour to send a digest email or sync data.

USE CASE 2

Run a cleanup job at midnight every day inside a long-running Go web server.

USE CASE 3

Skip a scheduled task if its previous run hasn't finished yet, using built-in job wrappers.

USE CASE 4

Log every scheduled job execution automatically with the provided logging wrapper.

What is it built with?

Go

How does it compare?

robfig/croncoredns/corednscloudflare/cloudflared
Stars14,12414,07614,179
LanguageGoGoGo
Setup difficultyeasymoderatemoderate
Complexity2/54/53/5
Audiencedeveloperops devopsops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires Go 1.11 or later, no external dependencies beyond the library itself.

So what is it?

This is a library for the Go programming language that lets a program run tasks on a schedule. The name comes from cron, a long-standing tool on Unix and Linux systems for running jobs automatically at set times, such as every minute, every hour, or at midnight on the first of the month. Instead of relying on the operating system's cron, this library brings that same scheduling ability directly inside a Go program, so a developer can say what should happen and when, all in their own code. The README is written mainly for developers and focuses on version 3 of the library, which was a major update. It shows how to download and import the package, and notes that it needs Go version 1.11 or later. Most of the document explains what changed in version 3 and what existing users need to adjust when upgrading from older versions, so it reads as release notes rather than a beginner tutorial. Schedules are described using a cron specification, which is a compact line of fields that say which minutes, hours, days, and months a job should run. The README explains that there are two common formats for this: the standard format used by the Linux cron utility, and a different format used by a Java tool called Quartz. Version 3 now uses the standard format by default, where the first field is the minute, and it offers an option to add a seconds field for finer control. Time zones can be set per schedule. The library also added a feature called job wrappers, which let you attach extra behavior around your scheduled tasks. Examples given include recovering from crashes inside a job, skipping or delaying a job if its previous run has not finished yet, and logging each time a job runs. The document lists several specific bug fixes and warns that version 3 is not fully compatible with versions 1 and 2, giving code snippets for adapting older programs.

Copy-paste prompts

Prompt 1
Using robfig/cron, write a Go program that prints 'tick' every minute and 'tock' at the top of every hour using cron expressions.
Prompt 2
How do I use robfig/cron's SkipIfStillRunning wrapper to prevent two runs of the same job overlapping in Go?
Prompt 3
Show me how to schedule a cron job in Go that runs at midnight in the Europe/London timezone using robfig/cron v3.
Prompt 4
How do I add panic recovery to a scheduled task in robfig/cron so a crash in one job doesn't stop the entire scheduler?

Frequently asked questions

What is cron?

A Go library that lets your program run functions on a schedule using cron-style timing strings, like 'every hour' or 'midnight on Fridays', without relying on the operating system's cron tool.

What language is cron written in?

Mainly Go. The stack also includes Go.

How hard is cron to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is cron for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.