Skip to content

Cron System

Human includes a cron-like scheduler that lets scheduled commands run on a recurring basis. Jobs are stored in a JSON crontab file and executed by the service loop when the gateway is running.

The cron CLI manages the crontab file at ~/.human/crontab.json:

Terminal window
human cron list # List all scheduled jobs
human cron add "<schedule>" <command> # Add a job
human cron remove <id> # Remove a job by ID

Example:

Terminal window
human cron add "0 9 * * *" "Check email and summarize"
human cron add "*/15 * * * *" echo "Heartbeat"
human cron list
human cron remove 1

Jobs are persisted in ~/.human/crontab.json as a JSON array:

[
{
"id": "1",
"schedule": "0 9 * * *",
"command": "Check email and summarize",
"enabled": true
}
]

Standard 5-field cron syntax:

┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *
ExpressionSchedule
0 9 * * *Every day at 9:00 AM
*/15 * * * *Every 15 minutes
0 0 * * 1Every Monday at midnight
0 8,17 * * 1-58 AM and 5 PM on weekdays

Cron behavior is configured in ~/.human/config.json under the cron key:

{
"cron": {
"enabled": true,
"interval_minutes": 30,
"max_run_history": 50
}
}
FieldDescriptionDefault
enabledEnable cron job executionfalse
interval_minutesHow often the scheduler ticks (1–1440)30
max_run_historyMax run records kept per job (0–10000)50

When running the gateway (human gateway or human service-loop), the WebSocket control protocol exposes additional cron methods:

MethodDescription
cron.listList scheduled jobs
cron.addAdd a job
cron.removeRemove a job
cron.runManually trigger a job

Use these from the Control UI or any client that connects to the gateway WebSocket.

Cron support requires HU_HAS_CRON (enabled by default). Without it, the cron command and control methods are unavailable.