How Gocron Simplifies Go‑Based Task Scheduling with a Web UI
Gocron is an open‑source Go scheduler that replaces Linux‑crontab with a lightweight, web‑driven interface, offering precise timing, retries, dependencies, and notifications for developers and operators seeking efficient task automation.
Overview
Gocron is an open‑source scheduling system written in Go. It provides a centralized web‑based scheduler that can replace Linux crontab, supporting second‑level cron expressions.
Key Features
Web UI for creating, editing, deleting and monitoring tasks.
Cron‑style expressions with second precision.
Automatic retry on failure and configurable timeout with forced termination.
Task dependency configuration (A must finish before B starts).
Role‑based permission control.
Two task types:
Shell command execution on one or more task nodes.
HTTP request execution directly by the scheduler.
Execution logs viewable in the UI.
Result notifications via email, Slack or generic webhook.
Architecture
Each scheduled job runs on a “task node”. A task node is a lightweight Go service that listens on port 5921. The scheduler communicates with nodes via HTTP to dispatch shell commands.
Installation
Download the binary or build from source, then start the scheduler and one or more task nodes. The UI is served on the scheduler’s HTTP port (default 8080). Example commands:
# Clone the repository
git clone https://github.com/ouqiang/gocron.git
cd gocron
# Build the scheduler
go build -o gocron cmd/gocron/main.go
# Start the scheduler
./gocron -port 8080
# Start a task node
./gocron-node -port 5921Adding a Task Node
In the UI, navigate to “Task Nodes” and add a new node specifying the server address and port 5921. The node must be reachable from the scheduler.
Creating a Task
When a main task has multiple subtasks, list them as SubTask1; SubTask2; in the “Subtasks” field.
The scheduler executes subtasks in reverse order, i.e. MainTask → SubTask2 → SubTask1. This behavior allows a parent task to wait for all children to finish.
Task Logs
Execution logs for each run are displayed in the UI and can be filtered by task, status or time range.
Repository
Project source code: https://github.com/ouqiang/gocron
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
