# go-co-op/gocron

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/go-co-op-gocron).**

7,071 stars · 342 forks · Go · MIT

## Links

- GitHub: https://github.com/go-co-op/gocron
- awesome-repositories: https://awesome-repositories.com/repository/go-co-op-gocron.md

## Description

gocron is a task scheduling library for Go designed to automate recurring tasks using crontab expressions, fixed durations, and specific calendar dates. It functions as a concurrent job manager and execution monitor that tracks task lifecycles and performance.

The project provides distributed task scheduling through leader election and distributed locking to prevent duplicate job execution across multiple nodes. It further distinguishes itself with a concurrency management system that implements singleton constraints and global execution quotas to protect system resources.

The scheduler covers a broad capability surface including event-driven listeners for job lifecycles, dynamic execution timing management, and graceful shutdown procedures. It also integrates observability tools for recording activity through pluggable logging interfaces and exporting execution metrics to external monitoring systems.

## Tags

### Development Tools & Productivity

- [Cron Scheduling](https://awesome-repositories.com/f/development-tools-productivity/cron-scheduling.md) — Provides a Go library for automating recurring tasks using crontab expressions, fixed durations, and calendar dates.
- [Job Schedulers](https://awesome-repositories.com/f/development-tools-productivity/job-schedulers.md) — Automates recurring tasks using crontab expressions, fixed durations, random intervals, and specific calendar dates. ([source](https://github.com/go-co-op/gocron#readme))
- [Task Scheduling](https://awesome-repositories.com/f/development-tools-productivity/task-scheduling.md) — Provides a Go-native framework for automating recurring tasks via cron expressions and intervals.
- [Dynamic Interval Calculations](https://awesome-repositories.com/f/development-tools-productivity/interval-based-task-execution/dynamic-interval-calculations.md) — Determines the next run time based on either a fixed schedule or the actual completion time of the last task.
- [Graceful Shutdown Procedures](https://awesome-repositories.com/f/development-tools-productivity/workflow-schedulers/schedule-lifecycle-controllers/graceful-shutdown-procedures.md) — Provides control over the scheduler lifecycle, including startup and graceful shutdown to ensure task completion. ([source](https://github.com/go-co-op/gocron/blob/v2/migration_v1_to_v2.md))

### DevOps & Infrastructure

- [Distributed Lock Coordination](https://awesome-repositories.com/f/devops-infrastructure/distributed-lock-coordination.md) — Prevents duplicate execution across multiple nodes using leader election and distributed locking. ([source](https://github.com/go-co-op/gocron#readme))
- [Distributed Task Schedulers](https://awesome-repositories.com/f/devops-infrastructure/distributed-task-schedulers.md) — Implements a distributed scheduling engine with leader election and locking to prevent duplicate job execution across multiple nodes.
- [Execution Status Monitoring](https://awesome-repositories.com/f/devops-infrastructure/automation-orchestration/task-execution-frameworks/task-job-management/task-schedulers/execution-status-monitoring.md) — Collects metrics on start times, completion status, execution durations, and concurrency limit breaches. ([source](https://github.com/go-co-op/gocron#readme))
- [Job Concurrency Controllers](https://awesome-repositories.com/f/devops-infrastructure/job-concurrency-controllers.md) — Prevents overlapping executions of the same job by implementing singleton concurrency constraints. ([source](https://github.com/go-co-op/gocron/blob/v2/executor.go))
- [Job Event Callbacks](https://awesome-repositories.com/f/devops-infrastructure/job-scheduling/job-event-callbacks.md) — Allows attaching listeners to individual jobs or the global scheduler to respond to execution events. ([source](https://github.com/go-co-op/gocron#readme))

### Programming Languages & Runtimes

- [Concurrency Management Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/task-orchestration-frameworks/concurrency-management-libraries.md) — Functions as a concurrent job manager that limits simultaneous executions via quotas and singleton constraints.
- [Scheduling Loops](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/asynchronous-execution-engines/event-driven-loops/scheduling-loops.md) — Uses a ticker-based execution loop to poll the system clock and trigger due jobs.

### Software Engineering & Architecture

- [Background Worker Orchestration](https://awesome-repositories.com/f/software-engineering-architecture/background-worker-orchestration.md) — Manages the lifecycle and timing of asynchronous jobs to ensure consistent execution periods and graceful shutdowns.
- [Distributed Job Locking](https://awesome-repositories.com/f/software-engineering-architecture/distributed-job-locking.md) — Prevents duplicate job execution across multiple nodes using a distributed locking mechanism.
- [Concurrent Task Limiters](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-task-runners/concurrent-task-limiters.md) — Implements concurrency limiting to protect system resources by restricting the number of simultaneous job executions.
- [Singleton Job Constraints](https://awesome-repositories.com/f/software-engineering-architecture/creational-design-patterns/singleton-patterns/singleton-job-constraints.md) — Ensures only one instance of a specific task runs at a time by skipping new triggers until the previous finishes.
- [Event Listeners](https://awesome-repositories.com/f/software-engineering-architecture/event-listeners.md) — Provides an event-driven system to trigger custom callbacks during job lifecycle events such as start or completion.

### Data & Databases

- [Execution Interval Management](https://awesome-repositories.com/f/data-databases/date-and-time-libraries/time-period-managements/execution-interval-management.md) — Determines whether the next run is calculated from the scheduled start time or from the completion time. ([source](https://github.com/go-co-op/gocron/blob/v2/README.md))

### System Administration & Monitoring

- [Task Execution Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/activity-monitors/task-execution-monitoring.md) — Tracks task lifecycle events, execution metrics, and performance logs through a pluggable monitoring interface.
- [Concurrency Limiters](https://awesome-repositories.com/f/system-administration-monitoring/resource-usage-limiters/concurrency-limiters.md) — Controls system load by restricting the number of concurrent background jobs within a Go process.

### Part of an Awesome List

- [Job Schedulers](https://awesome-repositories.com/f/awesome-lists/devtools/job-schedulers.md) — Fluent and actively maintained library for job scheduling.
