Skip to content

NowDev/cronwind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Cronwind

A simple and flexible cron job runner written in Rust that supports both command execution and HTTP requests.

Features

  • โœจ Simple JSON configuration
  • ๐Ÿ•’ Cron-style scheduling
  • ๐Ÿ”„ HTTP request jobs
  • ๐Ÿ’ป Command execution jobs
  • ๐Ÿ“ Logging support
  • ๐Ÿ”’ Type-safe configuration
  • ๐Ÿ” Environment ${VAR} parsing

Build the project

  1. Make sure you have Rust installed. If not, install it from rustup.rs

  2. Clone the repository:

git clone https://github.com/NowDev/cronwind.git
cd cronwind
  1. Build the project:
cargo build --release

The binary will be available at target/release/cronwind

Usage

  1. Create a config.json file with your job definitions
  2. Run the program:
./cronwind

To run in daemon mode (background):

./cronwind --daemon
# Logs will be written to ~/.cronwind/cronwind.log

Note: Service/systemd support soon

Configuration

Jobs are defined in config.json. Each job requires:

  • name: A unique identifier for the job
  • schedule: Cron expression (seconds minutes hours day_of_month month day_of_week)
  • kind: Type of job ("command" or "request")
  • config: Job-specific configuration

Example Configuration

{
  "jobs": [
    {
      "name": "echo-job",
      "schedule": "* * * * * *",
      "kind": "command",
      "config": {
        "command": "echo 'Hello, world!'"
      },
      "outputs": [
        {
          "kind": "file",
          "config": {
            "path": "echo.log"
          }
        }
      ]
    },
    {
      "name": "github-api-check",
      "schedule": "* 30 * * * *",
      "kind": "request",
      "config": {
        "method": "GET",
        "url": "https://api.github.com"
      },
      "outputs": []
    }
  ]
}

Note: See config.json for request body/header and env parsing examples.

Cron Schedule Format

The schedule uses the following format:

sec min hour day_of_month month day_of_week

Examples:

  • * * * * * * - Every second
  • 0 */5 * * * * - Every 5 minutes
  • 0 0 * * * * - Every hour
  • 0 0 0 * * * - Every day at midnight

License

It's just a personal utility, use it as you want.

About

Simple Cron Job Orchestrator in Rust ๐Ÿฆ€

Topics

Resources

Stars

Watchers

Forks

Languages