时间:2026-03-22 10:30
人气:
作者:admin
说出来你可能不信,我现在每天早上睁眼拿起手机,OpenClaw已经把当天要干的活整理好了。天气、资讯、日程…一目了然。定时任务YYDS!
这篇文章告诉你:怎么配置OpenClaw定时任务,让AI在指定时间自动干活。
定时任务核心是Cron表达式:
分 时 日 月 周
* * * * *
| 位置 | 含义 | 取值范围 |
|---|---|---|
| 第1位 | 分钟 | 0-59 |
| 第2位 | 小时 | 0-23 |
| 第3位 | 日 | 1-31 |
| 第4位 | 月 | 1-12 |
| 第5位 | 周 | 0-7(0和7都是周日) |
| 表达式 | 含义 |
|---|---|
0 8 * * * |
每天早上8点 |
0 18 * * 5 |
每周五下午6点 |
0 */2 * * * |
每隔2小时 |
0 9-18 * * 1-5 |
工作日上午9-18点,每小时 |
0 0 * * * |
每天午夜 |
0 8 * * 1-5 |
工作日早上8点 |
reminders:
# 每天早上8点天气
- name: morning_weather
cron: "0 8 * * *"
action: get_weather
params:
city: "上海"
notify:
channel: wechat
# 每周五下午周报
- name: weekly_report
cron: "0 18 * * 5"
action: generate_weekly_report
notify:
channel: wechat
format: markdown
reminders:
# 每天早上9点科技资讯
- name: morning_tech_news
cron: "0 9 * * *"
action: fetch_tech_news
notify:
channel: telegram
format: brief
# 每天下午6点热门话题
- name: evening_trending
cron: "0 18 * * *"
action: fetch_trending
notify:
channel: wechat
reminders:
# 每天下班汇总
- name: daily_summary
cron: "0 18 * * *"
action: generate_daily_summary
notify:
channels:
- wechat
- telegram
- name: weather_reminder
cron: "0 7 * * *"
action: get_weather
params:
cities:
- 上海
- 北京
- 深圳
notify:
channel: wechat
format: |
☀️ {{city}}今日天气:
温度:{{temp}}°
天气:{{weather}}
穿衣建议:{{dressing}}
- name: meeting_reminder
cron: "0 9 * * 1-5"
action: query_calendar
params:
range: "today"
notify:
channel: dingtalk
format: |
???? 今日会议:
{{#each meetings}}
- {{time}} {{title}}
{{/each}}
- name: health_reminder
cron: "0 12 * * *"
action: send_message
message: ",该喝水了!"
notify:
channel: telegram
- name: backup
cron: "0 3 * * *"
action: backup_data
params:
target: "/opt/openclaw"
destination: "/backup/openclaw"
notify:
channel: telegram
message: "备份完成"
解决:
docker logs openclaw解决:
reminders:
timezone: "Asia/Shanghai" # 设置时区
解决:
reminders:
- name: xxx
cron: "0 8 * * *"
run_once: true # 只执行一次
解决:
reminders:
- name: xxx
retry:
max: 3
interval: 5m
- name: work_day_only
cron: "0 9 * * *"
condition: "is_workday"
action: send_reminder
- name: interval_check
cron: "*/15 * * * *" # 每15分钟
action: check_status
- name: one_time
at: "2024-01-01 00:00:00"
action: celebrate
reminders:
timezone: "Asia/Shanghai"
timezone: "America/New_York"
reminders:
- name: parallel_task
cron: "*/5 * * * *"
parallel: true
max_workers: 3
reminders:
monitor:
enabled: true
alert_channels:
- telegram
- dingtalk
定时任务YYDS!配置好就等着躺平。
我现在每天早上自动收资讯,下午自动汇总,爽歪歪。
每天多出2小时摸鱼时间,它不香吗?
有问题评论区问,看到了都会回。
下期预告:
下一期讲讲插件安装与使用。敬请期待!
往期文章: