← 返回
未分类 中文

Schedule Task

Schedule and run recurring tasks on Linux/Unix systems. Use when user wants to set up cron jobs, scheduled backups, periodic data sync, automated reports, or...
在 Linux/Unix 系统上调度和运行周期性任务。适用于设置 cron 作业、定时备份、周期性数据同步、自动报告等场景。
dinghaibin
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 380
下载
💾 1
安装
1
版本
#latest

概述

Schedule Task

Schedule and manage recurring tasks using cron.

Quick Start

# Add a scheduled task
python scripts/scheduler.py add --cron "0 9 * * *" --command "backup.sh"

# List all tasks
python scripts/scheduler.py list

# Remove a task
python scripts/scheduler.py remove --id 1

Core Features

  • Cron Expression Parser: Validate and understand cron expressions
  • Task Management: Add, list, remove scheduled tasks
  • Health Checks: Monitor task execution status
  • Notifications: Alert on task failure

Cron Format

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6)
│ │ │ │ │
* * * * *

Common Examples

ExpressionMeaning
---------------------
0 9 *Daily at 9 AM
0 Every hour
/15 *Every 15 minutes
0 0 0Weekly on Sunday
0 0 1 Monthly on 1st

Script Usage

python scripts/scheduler.py [COMMAND] [OPTIONS]

Commands:
  add         Add a new scheduled task
  list        List all scheduled tasks
  remove      Remove a task
  enable      Enable a disabled task
  disable     Disable a task without removing
  log         Show task execution log
  health      Check task health status

Options

--cron TEXT      Cron expression (required for add)
--command TEXT   Command to run (required for add)
--name TEXT      Task name for identification
--log PATH       Log file path
--notify EMAIL   Email notification on failure
--timeout SECS   Task timeout in seconds

Examples

Daily Backup

python scripts/scheduler.py add \
  --cron "0 2 * * *" \
  --command "/home/user/backup.sh" \
  --name "daily-backup" \
  --log /var/log/backup.log

Hourly Sync

python scripts/scheduler.py add \
  --cron "0 * * *" \
  --command "sync-data.sh" \
  --name "hourly-sync"

Weekly Report

python scripts/scheduler.py add \
  --cron "0 9 * * 1" \
  --command "generate-report.sh" \
  --name "weekly-report"

Integration

With Web Monitor

# Monitor website every hour
python scripts/scheduler.py add \
  --cron "0 * * *" \
  --command "python /path/to/web-monitor/scripts/monitor.py --url https://example.com --compare last.json"

With Telegram Bot

# Send daily summary
python scripts/scheduler.py add \
  --cron "0 8 * * *" \
  --command "telegram-send 'Good morning! Daily summary ready'"

Best Practices

  1. Use absolute paths in commands
  2. Log output for debugging
  3. Set timeouts to prevent hanging tasks
  4. Test commands manually before scheduling
  5. Use UTC for server schedules

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 23:50 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Xxd Tool

dinghaibin
创建二进制文件的十六进制转储,将转储恢复为二进制,并进行位级分析与修补。适用于逆向工程、二进制分析等关键任务。
★ 0 📥 354

Datetime Tool

dinghaibin
全面的日期时间操作工具包,支持多种格式、时区转换、日历计算、自然语言解析以及日期...
★ 0 📥 396

Automation Workflow

dinghaibin
创建并管理自动化工作流,以处理重复性任务。适用于需要安排周期性数据同步、链式API调用、设置触发动作等场景。
★ 0 📥 359