Skip to content

[Feature] Add Scheduled Task Management with Cron Expression Support #19

Description

@anshul23102

Summary

daemon manages long-running services but not scheduled or recurring tasks. Adding task scheduling makes daemon a single tool for all background workloads.

Proposed Solution

Add a tasks section to the daemon config:

tasks:
  daily-backup:
    command: "bash scripts/backup.sh"
    schedule: "0 2 * * *"
    timeout: 600
    on_failure: retry
    retry:
      max_attempts: 3
      delay: 60

The scheduler checks every minute whether any task is due. On trigger: spawn the command as a child process, capture stdout/stderr to a task log file, record execution start time, end time, exit code, and status.

daemon tasks list shows all tasks with next scheduled run time. Dashboard "Tasks" tab shows last run result and a "Run Now" button for manual trigger.

Acceptance Criteria

  • Tasks run at the correct times per their cron expression.
  • daemon tasks list shows all tasks with their next run time.
  • Failed tasks with retry configured are retried the specified number of times.
  • Task output is captured to a separate log file.
  • "Run Now" triggers the task immediately without affecting the scheduled trigger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions