Skip to content

feat: add cron engine with TTL triggers, Redis CLI, and 6-field cron support#1

Open
nirmash wants to merge 8 commits intoembr-devs:mainfrom
nirmash:main
Open

feat: add cron engine with TTL triggers, Redis CLI, and 6-field cron support#1
nirmash wants to merge 8 commits intoembr-devs:mainfrom
nirmash:main

Conversation

@nirmash
Copy link
Copy Markdown

@nirmash nirmash commented Apr 14, 2026

Summary

Adds three major features to PulseBoard:

Cron Engine (TTL Triggers)

A cron job scheduler that uses Valkey key expiration as the trigger mechanism — no external scheduler needed.

  • How it works: Cron expressions are parsed into seconds-until-next-fire, set as a TTL on a Redis trigger key. When the key expires, a keyspace notification fires the job and recreates the key for the next run.
  • Supports both HTTP (PUT) and shell script execution
  • Job definitions persist in Redis hashes — restored on server restart
  • Dedicated ioredis subscriber connection for __keyevent@0__:expired events
  • Pause/resume, delete, and execution log per job

6-Field Cron with Seconds

Extended cron parser supports both formats:

  • 5 fields (standard): min hr dom mon dow
  • 6 fields (with seconds): sec min hr dom mon dow

Enables sub-minute scheduling (e.g., * * * * * * = every second).

Interactive Redis CLI

Terminal-style Redis client in the browser:

  • Execute any safe Redis command
  • Arrow-key command history
  • CLEAR to reset output
  • Dangerous commands blocked server-side

Other Changes

  • Cache mode switched to managed in embr.yaml
  • Added scripts/log-datetime.sh sample script for cron testing
  • Comprehensive README with features, cache modes, and configuration docs
  • Consistent panel spacing in the UI

New Files

File Purpose
server/cron/parser.js 5/6-field cron expression → TTL converter
server/cron/engine.js Keyspace notification listener + job executor
server/routes/cron.js Cron job CRUD API
server/routes/redisCli.js Safe Redis command execution API
client/src/CronJobs.jsx Cron engine UI
client/src/RedisCli.jsx Redis CLI UI
scripts/log-datetime.sh Sample cron script
README.md Full documentation

Tested

  • Deployed to Embr with managed cache mode
  • Cron job created, fired, logged, and rescheduled successfully
  • Script execution verified via embr shell (/tmp/cron-log.txt populated)
  • Redis CLI tested with KEYS, TTL, and other commands

nirmash and others added 8 commits April 13, 2026 17:50
- Cron engine uses Valkey keyspace notifications to fire jobs on key expiry
- Dedicated Redis subscriber connection for __keyevent@0__:expired events
- 5-field cron parser converts expressions to seconds-until-next-fire TTLs
- Jobs support both HTTP requests and shell script execution
- Job definitions persist in Redis hashes, restored on server restart
- Interactive Redis CLI panel with command history and safe command filtering
- New UI panels: Cron Engine (create/pause/delete jobs, view logs) and Redis CLI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…uration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants