0PricingLogin
Go Academy · Lesson

The robfig/cron Library

Schedule with cron syntax.

Cron Expressions in Go

The robfig/cron library lets you schedule jobs with familiar cron syntax instead of hand-written time math. Install with go get github.com/robfig/cron/v3.

import "github.com/robfig/cron/v3"

Cron Syntax Refresher

A standard cron expression has five fields:

  • minute (0-59)
  • hour (0-23)
  • day of month (1-31)
  • month (1-12)
  • day of week (0-6)

Example: 0 9 * * 1-5 = 9:00 AM on weekdays.

All lessons in this course

  1. Time-Based Scheduling
  2. The robfig/cron Library
  3. Tickers for Intervals
  4. Graceful Job Shutdown
← Back to Go Academy