services/cron/schedule

Cron schedule parsing — extracted to avoid import cycles with plugins/tools/cron. Pure parsing module with no dependencies on core/loop or sqlight.

Types

pub type CronJob {
  CronJob(
    alias: String,
    schedule: CronSchedule,
    job_type: JobType,
  )
}

Constructors

pub type CronSchedule {
  CronSchedule(
    minute: Field,
    hour: Field,
    dom: Field,
    month: Field,
    dow: Field,
  )
}

Constructors

pub type CurrentTime {
  CurrentTime(
    minute: Int,
    hour: Int,
    dom: Int,
    month: Int,
    dow: Int,
  )
}

Constructors

  • CurrentTime(
      minute: Int,
      hour: Int,
      dom: Int,
      month: Int,
      dow: Int,
    )
pub type Field {
  Star
  Value(Int)
  Range(Int, Int)
  Step(Int)
  List(List(Field))
}

Constructors

  • Star
  • Value(Int)
  • Range(Int, Int)
  • Step(Int)
  • List(List(Field))
pub type JobType {
  ShellJob(command: String)
  AgentJob(prompt: String)
}

Constructors

  • ShellJob(command: String)
  • AgentJob(prompt: String)

Values

pub fn cron_matches(
  schedule: CronSchedule,
  now: CurrentTime,
) -> Bool

Check whether a cron schedule matches a given minute-of-week value.

pub fn parse_schedule(
  expr: String,
) -> Result(CronSchedule, String)

Parse a 5-field cron expression like “0 9 * * 1-5” into a CronSchedule.

Search Document