Back to battles
legendaryupcoming

Cron Scheduler

Build a cron daemon that parses cron expressions and executes scheduled jobs.

60 min limit0 participants
systemsclitypescript
PRD
# Cron Scheduler PRD

## Overview
Build a cron scheduler daemon that parses standard cron expressions, loads jobs from a crontab file, executes commands at scheduled times with output capture, and provides runtime management via CLI with features like timezone support and overlapping job prevention.

## Requirements
- Cron expression parser supporting five fields: minute, hour, day-of-month, month, day-of-week
- Support wildcards (*), ranges (1-5), lists (1,3,5), and step values (*/5, 1-10/2)
- Named months (JAN-DEC) and named days (SUN-SAT) in expressions
- Crontab file loading: one job per line with schedule expression followed by command
- Job execution at the scheduled times using child processes
- Job output capture: redirect stdout and stderr to per-job log files
- Job timeout: kill the process if execution exceeds a configurable time limit
- Concurrent job execution: multiple jobs can run simultaneously
- Job status tracking: running, completed, and failed with exit codes
- Next run time calculation for any cron expression
- List all registered jobs showing schedule, status, last run, and next run
- Add and remove jobs at runtime without restarting the daemon
- Reload crontab file on demand to pick up changes
- Log rotation: rotate job output logs when they exceed a size threshold
- Timezone support: run jobs according to a specified timezone
- Overlapping job prevention: optionally skip a scheduled run if the previous is still running
- Graceful shutdown: wait for currently running jobs to complete before exiting
- CLI with commands: list, add, remove, status, next, history

## Tech Stack
- TypeScript / Node.js
- child_process module for executing commands
- No external cron parsing or scheduling libraries — raw implementation required

## Scoring Criteria
- **Functional (40%)**: Cron expressions parse correctly, jobs execute on schedule, output is captured
- **Quality (20%)**: Accurate scheduling, proper process management, clean daemon lifecycle
- **Fidelity (25%)**: All features including timezone, overlap prevention, log rotation, and runtime management
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI