Skip to content

Scheduling

Workflows can be scheduled to run automatically using cron expressions. This is useful for recurring operations like daily backups, periodic compliance checks, or scheduled maintenance windows.

Cron Configuration

Add a cron array to your workflow definition:

label: daily_backup
name: daily_backup
package: wf.example.neops.io
majorVersion: 1
minorVersion: 0
patchVersion: 0
seedEntity: device
type: workflow

cron:
  - title: "Daily Backup"
    description: "Back up running config of all core routers"
    query: "platform.shortName: ios AND facts.role: core"
    enabled: true
    concurrency: false
    crontab:
      second: "0"
      minute: "0"
      hour: "2"
      dayOfMonth: "*"
      month: "*"
      dayOfWeek: "1-5"
      timezone: "Europe/Zurich"

Cron Fields

Field Required Description
title Yes Human-readable title (max 100 chars)
description Yes What this schedule does (max 500 chars)
query Yes Elasticsearch query to select entities for execution
crontab Yes Cron schedule (see below)
enabled Yes Whether the schedule is active
concurrency Yes Allow multiple instances to run simultaneously
parameters No Parameters passed to each execution
condition No JMESPath condition (skip execution if false)

Crontab Format

All fields are required and follow standard cron syntax:

Field Range Examples
second 0-59 0, */15, 0,30
minute 0-59 30, */5
hour 0-23 2, 9-17
dayOfMonth 1-31 *, 1,15
month 1-12 *, 1-6
dayOfWeek 0-6 (0=Sunday) 1-5 (weekdays), 0,6 (weekends)
timezone IANA timezone Europe/Zurich, America/New_York

Multiple Schedules

A single workflow can have multiple cron entries for different scopes or times:

cron:
  - title: "Core routers - daily"
    description: "Daily backup of core routers"
    query: "facts.role: core"
    enabled: true
    concurrency: false
    crontab:
      second: "0"
      minute: "0"
      hour: "2"
      dayOfMonth: "*"
      month: "*"
      dayOfWeek: "*"
      timezone: "Europe/Zurich"

  - title: "Access switches - weekly"
    description: "Weekly backup of access layer"
    query: "facts.role: access"
    enabled: true
    concurrency: false
    crontab:
      second: "0"
      minute: "0"
      hour: "3"
      dayOfMonth: "*"
      month: "*"
      dayOfWeek: "0"
      timezone: "Europe/Zurich"

Common Cron Patterns

Pattern second minute hour dayOfMonth month dayOfWeek
Every 5 minutes 0 */5 * * * *
Hourly 0 0 * * * *
Daily at 2 AM 0 0 2 * * *
Weekdays at 6 AM 0 0 6 * * 1-5
Sundays at 3 AM 0 0 3 * * 0
First of month at midnight 0 0 0 1 * *

Note

The second field is non-standard (most cron implementations only have 5 fields). Always set it to "0" unless you need sub-minute scheduling.