Contents

Chapter 1

Features

This chapter covers the core features and capabilities of Task Scheduler.

Features

  • Cron expressions β€” Full 5-field parser supporting *, */n, a-b, a,b,c, and combinations
  • Interval scheduling β€” Run tasks every N seconds with drift-free tracking
  • One-shot tasks β€” Fire once at a specified datetime, then never again
  • Priority queue β€” Higher-priority tasks run first when multiple are due simultaneously
  • Concurrency control β€” Cap the number of tasks running in parallel via thread semaphore
  • Retry with backoff β€” Failed tasks retry up to N times with configurable exponential delay
  • Missed-run policy β€” Choose catch_up (fire immediately on overdue) or skip (wait for next window)
  • State persistence β€” Schedule state and last-run timestamps survive restarts via JSON file
  • Built-in demo tasks β€” heartbeat, disk_usage, and cleanup_tmp for testing without shell commands
  • Single-tick mode β€” --once runs one scheduler pass and exits (ideal for testing and cron-driven invocation)

Requirements

  • Python 3.10+
  • No external dependencies (stdlib only)
Chapter 2

Quick Start

Follow this guide to get Task Scheduler up and running in your environment.

Quick Start

bash
# Show all CLI options
python src/task_scheduler.py --help

# List tasks with their next scheduled fire times
python src/task_scheduler.py --config examples/task_scheduler_config.json --list

# Run a single scheduler tick (fires due tasks, then exits)
python src/task_scheduler.py --config examples/task_scheduler_config.json --once

# Start the daemon loop (Ctrl-C to stop)
python src/task_scheduler.py --config examples/task_scheduler_config.json

# Override state file location and log level
python src/task_scheduler.py --config examples/task_scheduler_config.json --state-file /tmp/state.json --log-level DEBUG

Configuration Reference

Create a JSON config to define your task schedule:

json
{
    "settings": {
        "max_concurrency": 3,
        "tick_interval": 1.0,
        "state_file": "scheduler_state.json"
    },
    "tasks": [
        {
            "name": "my-task",
            "schedule_type": "cron",
            "schedule_value": "*/5 * * * *",
            "command": "echo 'hello'",
            "priority": 3,
            "retry_limit": 2,
            "retry_backoff": 2.0,
            "missed_policy": "skip",
            "enabled": true
        }
    ]
}

CLI Options

FlagDefaultDescription
--config, -c*(required)*Path to the JSON schedule config file
--oncefalseExecute a single scheduler tick then exit
--listfalsePrint every task with its next fire time and exit
--state-file/scheduler_state.jsonOverride the state-file path
--log-levelINFOLogging verbosity (DEBUG, INFO, WARNING, ERROR)

Cron Syntax

Standard 5-field format: minute hour day-of-month month day-of-week

FieldRangeExamples
Minute0–590, */5, 0,15,30,45
Hour0–239, 0-8, */2
Day of month1–311, 1,15, 10-20
Month1–12*, 1,4,7,10, 6-8
Day of week0–71-5 (Mon–Fri), 0 or 7 (Sun)

Operators: * (all), */n (step), a-b (range), a-b/n (range+step), a,b,c (list).

Task Fields

Task FieldTypeDefaultDescription
namestring*(required)*Unique task identifier
schedule_typestring*(required)*"cron", "interval", or "once"
schedule_valuestring*(required)*Cron expression, seconds, or ISO datetime
commandstring""Shell command to execute
builtinstring""Name of a built-in callable (heartbeat, disk_usage, cleanup_tmp)
priorityint51 (highest) to 10 (lowest)
retry_limitint3Max retry attempts on failure
retry_backofffloat2.0Exponential backoff multiplier (delay = backoff ^ attempt)
missed_policystring"skip""skip" (next window) or "catch_up" (fire immediately)
enabledbooltrueSet false to suspend without removing
Chapter 3
πŸ”’ Available in full product

Output

Chapter 4
πŸ”’ Available in full product

04_License

You’ve reached the end of the free preview

Get the full Task Scheduler and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $19 →
πŸ“¦ Free sample included — download another copy for the full product.
Task Scheduler v1.0.0 β€” Free Preview