Skip to content

ai-scheduler

Kodachi Scheduler Daemon - Cron-based command scheduling with security whitelist

Version: 9.0.1 | Size: 4.0MB | Author: Warith Al Maawali

License: Proprietary | Website: https://www.digi77.com


File Information

Property Value
Binary Name ai-scheduler
Version 9.0.1
Build Date 2026-02-26T08:01:54.969933937Z
Rust Version 1.82.0
File Size 4.0MB
JSON Data View Raw JSON

SHA256 Checksum

01a01bcbd9d80f41a140f717c957d0b8b0c5cb18b513a6c92f13951fe58bce0b

Features

Feature Description
Feature Cron expression parsing ("0 * * * *")
Feature Event-driven triggers
Feature Command whitelist validation
Feature Execution history tracking

Security Features

Feature Description
Inputvalidation All inputs are validated and sanitized
Ratelimiting Built-in rate limiting for network operations
Authentication Secure authentication with certificate pinning
Encryption TLS 1.3 for all network communications

System Requirements

Requirement Value
OS Linux (Debian-based)
Privileges root/sudo for system operations
Dependencies OpenSSL, libcurl

Global Options

Flag Description
-h, --help Print help information
-v, --version Print version information
-n, --info Display detailed information
-e, --examples Show usage examples
--json Output in JSON format
--json-pretty Pretty-print JSON output with indentation
--json-human Enhanced JSON output with improved formatting (like jq)
--verbose Enable verbose output
--quiet Suppress non-essential output
--no-color Disable colored output
--config <FILE> Use custom configuration file
--timeout <SECS> Set timeout (default: 30)
--retry <COUNT> Retry attempts (default: 3)

Commands

Daemon Control

start

Start the scheduler daemon

Usage:

ai-scheduler start [OPTIONS]

Schedule Management

add

Add a new scheduled task

Usage:

ai-scheduler add [OPTIONS]

list

List all scheduled tasks

Usage:

ai-scheduler list [OPTIONS]

remove

Remove a scheduled task

Usage:

ai-scheduler remove [OPTIONS]

Operational Scenarios

Scenario-oriented workflows generated from the binary's built-in -e --json examples.

Scenario 1: Daemon Control

Start and manage the scheduler daemon

Step 1: Start scheduler daemon

sudo ai-scheduler start
Expected Output: Scheduler daemon started successfully

Note

Runs as background service

Step 2: Start in foreground mode for debugging

sudo ai-scheduler start --foreground
Expected Output: Scheduler running in foreground with live output

Note

Useful for debugging and testing scheduled tasks

Step 3: Foreground mode with JSON status output

sudo ai-scheduler start --foreground --json
Expected Output: JSON events as tasks are scheduled and executed

Note

Combines debug visibility with structured output

Step 4: Start daemon with JSON status output

sudo ai-scheduler start --json
Expected Output: JSON response with daemon process info

Note

Useful for automated monitoring

Scenario 2: Schedule Management

Add, list, and remove scheduled tasks

Step 1: Schedule a daily network check at 8 AM

ai-scheduler add --name "daily-check" --command "health-control net-check" --cron "0 8 * * *"
Expected Output: Task scheduled successfully with ID

Note

Cron syntax: minute hour day month weekday

Step 2: Check Tor status every hour

ai-scheduler add --name "hourly-tor" --command "tor-switch tor-status" --cron "0 * * * *"
Expected Output: Hourly task created successfully

Note

Executes at the start of each hour

Step 3: Schedule DNS leak check every 30 minutes with JSON output

ai-scheduler add --name "dns-check" --command "dns-leak test" --cron "*/30 * * * *" --json
Expected Output: JSON with task ID and schedule details

Note

Full add command with all parameters and structured output

Step 4: Schedule weekly cleanup every Sunday at 2 AM

ai-scheduler add --name "weekly-cleanup" --command "health-control cleanup" --cron "0 2 * * 0" --json
Expected Output: Task details in JSON format

Note

Weekday 0 = Sunday, 1 = Monday, etc.

Step 5: List all scheduled tasks

ai-scheduler list
Expected Output: Table of scheduled tasks with IDs and status

Note

Shows task name, command, schedule, and next run

Step 6: List scheduled tasks as JSON

ai-scheduler list --json
Expected Output: Task list in JSON format

Note

Structured output for automation

Step 7: Remove scheduled task by ID

ai-scheduler remove 1
Expected Output: Task removed successfully

Note

Use 'list' command to find task IDs

Step 8: Remove task with JSON confirmation

ai-scheduler remove 2 --json
Expected Output: JSON response confirming task removal

Scenario 3: Gateway Core Policy Validation

Scheduler command validation is aligned with shared ai-gateway core policy and sanitization rules

Step 1: Valid passive command accepted by shared gateway-core validator

ai-scheduler add --name "tor-health" --command "tor-switch tor-status" --cron "*/15 * * * *" --json
Expected Output: Task created successfully

Step 2: Unknown service is rejected by shared validator before scheduling

ai-scheduler add --name "blocked-test" --command "malicious-binary run" --cron "0 * * * *" --json
Expected Output: Validation error indicating service is blocked

Command Examples (Raw)

Daemon Control

Start and manage the scheduler daemon

Start scheduler daemon

sudo ai-scheduler start
Expected Output: Scheduler daemon started successfully

Note

Runs as background service

Start in foreground mode for debugging

sudo ai-scheduler start --foreground
Expected Output: Scheduler running in foreground with live output

Note

Useful for debugging and testing scheduled tasks

Foreground mode with JSON status output

sudo ai-scheduler start --foreground --json
Expected Output: JSON events as tasks are scheduled and executed

Note

Combines debug visibility with structured output

Start daemon with JSON status output

sudo ai-scheduler start --json
Expected Output: JSON response with daemon process info

Note

Useful for automated monitoring

Schedule Management

Add, list, and remove scheduled tasks

Schedule a daily network check at 8 AM

ai-scheduler add --name "daily-check" --command "health-control net-check" --cron "0 8 * * *"
Expected Output: Task scheduled successfully with ID

Note

Cron syntax: minute hour day month weekday

Check Tor status every hour

ai-scheduler add --name "hourly-tor" --command "tor-switch tor-status" --cron "0 * * * *"
Expected Output: Hourly task created successfully

Note

Executes at the start of each hour

Schedule DNS leak check every 30 minutes with JSON output

ai-scheduler add --name "dns-check" --command "dns-leak test" --cron "*/30 * * * *" --json
Expected Output: JSON with task ID and schedule details

Note

Full add command with all parameters and structured output

Schedule weekly cleanup every Sunday at 2 AM

ai-scheduler add --name "weekly-cleanup" --command "health-control cleanup" --cron "0 2 * * 0" --json
Expected Output: Task details in JSON format

Note

Weekday 0 = Sunday, 1 = Monday, etc.

List all scheduled tasks

ai-scheduler list
Expected Output: Table of scheduled tasks with IDs and status

Note

Shows task name, command, schedule, and next run

List scheduled tasks as JSON

ai-scheduler list --json
Expected Output: Task list in JSON format

Note

Structured output for automation

Remove scheduled task by ID

ai-scheduler remove 1
Expected Output: Task removed successfully

Note

Use 'list' command to find task IDs

Remove task with JSON confirmation

ai-scheduler remove 2 --json
Expected Output: JSON response confirming task removal

Gateway Core Policy Validation

Scheduler command validation is aligned with shared ai-gateway core policy and sanitization rules

Valid passive command accepted by shared gateway-core validator

ai-scheduler add --name "tor-health" --command "tor-switch tor-status" --cron "*/15 * * * *" --json
Expected Output: Task created successfully

Unknown service is rejected by shared validator before scheduling

ai-scheduler add --name "blocked-test" --command "malicious-binary run" --cron "0 * * * *" --json
Expected Output: Validation error indicating service is blocked

Environment Variables

Variable Description Default Values
RUST_LOG Set logging level info error
NO_COLOR Disable all colored output when set unset 1

Exit Codes

Code Description
2 Invalid arguments
5 File not found
1 General error
3 Permission denied
4 Network error
0 Success