Skip to content

Add scheduled/cron service mode for periodic tasks #170

@jongio

Description

@jongio

Feature Request

Problem

There's currently no way to define a service that runs on a schedule (e.g., every N minutes/hours). The existing service modes cover continuous processes (daemon), one-time tasks (task), file watchers (watch), and builds (build), but periodic/scheduled execution requires workarounds like writing a daemon with an internal sleep loop.

Proposal

Add a scheduled service mode (or a schedule field) that accepts a cron expression or interval, allowing services to run periodically as part of azd app run.

Example:

services:
  cleanup:
    type: process
    mode: scheduled
    schedule: "0 */6 * * *"  # Every 6 hours
    command: python scripts/cleanup.py
    healthcheck: false

Or with interval shorthand:

services:
  sync:
    type: process
    mode: scheduled
    schedule: "every 30m"
    command: ./scripts/sync.sh

Use Cases

  • Periodic data exports or imports
  • Cache warming / invalidation
  • Log rotation or cleanup scripts
  • Health report generation
  • Database maintenance tasks (vacuum, reindex)
  • Scheduled backups

Behavior

  • Service shows in dashboard with next-run countdown
  • Logs from each execution are captured like any other service
  • Exit code tracked per execution (success/failure history)
  • mode: scheduled implies type: process (no port needed)
  • Missed schedules during downtime: configurable (skip or run-on-start)

Alternatives Considered

  • Daemon with internal loop: Works but pushes scheduling logic into every script
  • OS-level cron/Task Scheduler: Outside azd-app's visibility, no dashboard integration, no log aggregation
  • Container with cron: Heavy for simple scripts

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions