# Gronx for checking cron schedules inside Go applications

> Gronx evaluates cron expressions at a supplied time, searches for nearby matches, and offers a separate task runner for applications that need to execute jobs.

**adhocore/gronx** — Lightweight, fast and dependency-free Cron expression parser (due checker, next/prev due date finder), task runner, job scheduler and/or daemon for Golang (tested on v1.13+) and standalone usage. If you are bold, use it to replace crontab entirely.

- Repository: https://github.com/adhocore/gronx
- Website: https://github.com/adhocore/gronx
- Stars: 514 · Forks: 40
- Language: Go
- License: MIT
- Published: 2026-11-24 · Updated: 2026-11-24 · Language: en
- Canonical page: https://hysenlabs.com/projects/adhocore-gronx

## Put cron evaluation inside a Go process

Gronx gives a Go program a way to evaluate a cron expression against a timestamp. A service that accepts schedules from users can check an expression before storing it, calculate a preview, and use the same expression to decide whether work is due. The library also exposes its scheduler as a separate package and documents a standalone tasker command. That gives the application an important choice about ownership. A settings screen that needs to preview an expression needs the evaluator alone. A process assigned to run local maintenance commands can use tasker to own the schedule and invoke the commands.

The tagged source separates expression normalization and validation in gronx.go from the segment checks in checker.go. The latter derives the relevant calendar value from the reference timestamp according to the segment position. This makes the reference time part of the input to a scheduling decision. It is useful to preserve the time zone alongside a stored expression when the schedule is supposed to describe local calendar time.

## Add the library and check a fixed time

The README gives this command for adding the library to a Go project.

```bash
go get -u github.com/adhocore/gronx
```

Run it from the application module. The update flag can change dependency selections, so examine the resulting module and checksum changes before committing them. For a first check, open the Usage section of the project README and use its IsDue example that passes a time constructed with time.Date in UTC. The example uses a wildcard expression for all five fields. With that reference it should return true and a nil error. Keep both return values. A malformed expression and a schedule that simply does not match need different treatment in a form or an import job. A validation step can reject bad input before a worker ever sees it. The explicit time also lets a unit test repeat the same due check without relying on the wall clock.

## Preview the boundary before dispatching

The README distinguishes IsDue from the NextTick and PrevTick families. IsDue asks about a point in time. NextTickAfter and PrevTickBefore look for matching times from a supplied reference. Each direction has an option that controls whether a matching reference itself is eligible. A next-run display loaded exactly at a match can therefore show that instant or advance to the next one, depending on which meaning the product wants. A job search that repeatedly advances from its previous result should exclude that result on the next call. A single screen that shows a previous and next time needs an explicit policy for whether the reference can appear on either side.

BatchDue is useful when expressions should share a single reference time. The README shows results with Due and Err on each item, so an invalid entry can be handled individually. Pass the reference in explicitly when the caller already knows which scheduling interval it is processing.

## Choose who owns execution and recovery

The README describes using an operating system crontab to invoke one Go program every minute, with that program deciding which registered jobs are due. A plain host crontab can also schedule each command directly. That alternative keeps the scheduling configuration on the host and avoids embedding a polling loop in an application. The embedded evaluator makes sense if schedules are application data, or if the application exposes a preview before a user saves an expression.

The tasker package gives a Go application a different arrangement. The README shows registering callbacks with Task, configuring a time zone, and starting the runner with Run. It also documents an overlap option. The five-field expression in the library tutorial is minute-based, while Gronx also supports a seconds field. A minute-based host crontab entry cannot provide a dispatch opportunity every second. Due checks also establish eligibility at a timestamp only. Applications that require a durable record of successful execution need to maintain that record in their own job handling.

## Review the version and license before importing

The latest release in the repository record is v1.20.5, dated 2026-09-27. The repository record lists its most recent push on that date. The module file declares Go 1.13 and lists no module requirements. Treat the declared Go version as module metadata and check the release with the Go toolchain used by the consuming application. The tagged LICENSE grants permission under the MIT License and includes a requirement to retain the copyright and permission notice in copies or substantial portions of the software. The tagged README and source are available from https://github.com/adhocore/gronx/tree/v1.20.5. For an upgrade, rerun fixed-time examples around schedule boundaries that matter to the application, especially where the caller uses the optional current-tick behavior.

## Conclusion

Use Gronx when a Go application owns schedule input or needs a preview at a specified time. Keep individual commands in host crontab when the host already owns their configuration. Before moving execution into the application, check how the selected field count and current-tick setting affect which timestamps your worker will process.

## FAQ

### Can Gronx check a schedule for a supplied time?

Yes. The README shows passing a time.Time to IsDue.

### Can Gronx find the last matching time?

Yes. PrevTickBefore searches backward from a supplied reference and accepts a setting that controls whether that reference is eligible.

### Does Gronx expose a standalone scheduler?

Yes. The README describes the standalone tasker daemon as well as the Go tasker package.

## Sources

- [adhocore/gronx on GitHub](https://github.com/adhocore/gronx)
- [License: MIT](https://github.com/adhocore/gronx/blob/main/LICENSE)
- [Project website](https://github.com/adhocore/gronx)
- [README](https://github.com/adhocore/gronx/blob/main/README.md)
- [Releases](https://github.com/adhocore/gronx/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/adhocore-gronx
