From 002522a5404f39193393ecf579b36eb3c122ab20 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 27 Feb 2026 15:22:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=EF=BC=9A=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E4=B8=80=E8=A1=8C=20crontab=EF=BC=8C=E6=97=A0=E9=9C=80?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E8=84=9A=E6=9C=AC=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- skills/weekly-report/README.md | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/skills/weekly-report/README.md b/skills/weekly-report/README.md index 8bee19a..7578d4e 100644 --- a/skills/weekly-report/README.md +++ b/skills/weekly-report/README.md @@ -110,23 +110,15 @@ Claude 会自动执行以下流程: ## 定时自动发送(Cron) -通过 `claude -p` 非交互模式配合定时任务实现每周自动发送。 +### Linux / Mac -新建 `~/weekly_report.sh`,把密码直接写在脚本里,设置好权限确保只有自己可读: +`crontab -e` 添加一行(每周五 18:00): -```bash -#!/bin/bash -export SMTP_USER=your@email.com -export SMTP_PASSWORD=your-auth-code -export GITEA_TOKEN=your-gitea-token # 私有仓库才需要 - -cd /path/to/your-project -claude -p "/weekly-report" +``` +0 18 * * 5 cd /path/to/your-project && SMTP_USER=xxx SMTP_PASSWORD=xxx claude -p "/weekly-report" >> ~/weekly_report.log 2>&1 ``` -```bash -chmod 600 ~/weekly_report.sh -``` +crontab 文件权限默认仅限当前用户,密码写在里面是安全的。 ### Windows(任务计划程序) @@ -134,15 +126,7 @@ chmod 600 ~/weekly_report.sh 2. 触发器:每周,设置具体时间(如每周五 18:00) 3. 操作:启动程序 - 程序:`C:\Program Files\Git\bin\bash.exe` - - 参数:`-l -c "/c/Users/你的用户名/weekly_report.sh"` - -### Linux / Mac(crontab) - -```bash -crontab -e -# 添加(每周五 18:00): -0 18 * * 5 /bin/bash ~/weekly_report.sh >> ~/weekly_report.log 2>&1 -``` + - 参数:`-l -c "cd /e/your-project && SMTP_USER=xxx SMTP_PASSWORD=xxx claude -p '/weekly-report'"` > 如遇「命令未找到」,将 `claude` 替换为绝对路径(用 `which claude` 查询)。