Cron Evaluator

Automation

Cron Evaluator — Analyzes and scores cron jobs on a system for health, resource usage, collision risk, and resilience. Provides actionable suggestions for improvement. Use when: (1) auditing cron jobs, (2) detecting timing collisions, (3) optimizing cron performance, (4) planning systemd migration.

Install

openclaw skills install cron-evaluator

Cron Evaluator

Evaluates cron job health across 4 pillars: Temporal, Resource, Resilience, and Pertinence.

4 Pillars

PillarChecksScore Range
TemporalMidnight collision, frequency, jitter0-1
ResourceHeavy commands (torch, docker, ollama)0-1
ResilienceLogging, flock, timeout, error handling0-1
PertinenceCron vs systemd timer recommendation0-1

Usage

# Scan all cron jobs
python3 cron_evaluator_v3.py --scan

# Run health check
python3 cron_evaluator_v3.py --health

# Get improvement suggestions
python3 cron_evaluator_v3.py --suggest

Health Thresholds

ScoreStatus
>80%🟢 HEALTHY
60-80%🟡 NEEDS_WORK
<60%🔴 CRITICAL

Key Checks

Temporal Collision Detection

# Two crons at 00:00 → suggest jitter
if cron1['time'] == '0 0 * * *' and cron2['time'] == '0 0 * * *':
    suggest("Add jitter: sleep $((RANDOM % 60))")

Resource Signatures

HEAVY_COMMANDS = ['torch', 'tensorflow', 'ollama', 'docker']
if any(h in command for h in HEAVY_COMMANDS):
    score -= 0.3  # Heavy resource consumer

Resilience Verification

CHECKS = {
    'logging': '>> /var/log/...' in command or '2>' in command,
    'flock': 'flock' in command,
    'timeout': 'timeout' in command,
    'error_handling': '||' in command
}

Jitter Implementation

# BEFORE (collision risk)
0 2 * * * /path/to/script.sh

# AFTER (staggered with jitter)
0 2 * * * sleep $((RANDOM % 60)) && /path/to/script.sh

Wrapper for Observability

# Wrapper that logs time/exit/memory
0 2 * * * /usr/bin/python3 /opt/evaluator/wrapper.py --task "TaskName" --cmd "/path/to/script.sh"

Files

cron-evaluator/
├── SKILL.md                   # This file
├── scripts/
│   ├── cron_evaluator.py      # v1 (basic)
│   ├── cron_evaluator_v2.py   # v2 (enhanced)
│   ├── cron_evaluator_v3.py   # v3 (with KAN)
│   └── train_cron_kan.py     # KAN training script
├── data/
│   └── cron_training.json     # Training dataset
└── models/
    └── cron_kan.pt           # Trained KAN model

KAN Model

The Cron KAN (16→32→16→8→4→3) predicts cron job quality from 16 features extracted from schedule and command patterns.