Files
Obsidian/MyBestNanobot/Nanobot的定时任务.md
2026-07-21 14:53:24 +08:00

167 lines
6.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 📋 **当前cron定时任务汇总**
### **总计:6个有效定时任务**
---
### 🕐 **按时间排序的任务列表**
#### 1. **小红书Cookie监控** ⏰ 每天 08:00 (UTC)
```
0 8 * * * /home/ubuntu/.nanobot/workspace/skills/xiaohongshu_integration/daily_cookie_monitor.sh
```
- **北京时间**: 16:00
- **功能**: 检查小红书cookie有效性
- **日志**: `/home/ubuntu/.nanobot/workspace/xiaohongshu_logs/cron.log`
#### 2. **小红书热点趋势自动化** ⏰ 每天 10:00 (UTC)
```
0 10 * * * /bin/bash /home/ubuntu/nanocode/xhs_trending_automation/scripts/scheduler.sh
```
- **北京时间**: 18:00
- **功能**: 自动抓取小红书热点,AI创作发布
- **项目**: `/home/ubuntu/nanocode/xhs_trending_automation/`
#### 3. **统一备份系统** ⏰ 每周四 03:00 (UTC)
```
0 3 * * 4 /bin/bash /home/ubuntu/nanocode/backup_unified.sh
```
- **北京时间**: 周四 11:00
- **功能**: 备份所有skill+记忆文件+配置
- **日志**: `/home/ubuntu/nanocode/backup_logs/unified_backup.log`
- **备份位置**: `/home/ubuntu/nanocode/backups/`
#### 4. **IT资讯自动化系统** ⏰ 每天 16:00 (UTC)
```
0 16 * * * /home/ubuntu/.nanobot/workspace/InformationCrawler/load_env.sh /home/ubuntu/.nanobot/workspace/InformationCrawler/main_scheduler_with_xhs_fixed.sh
```
- **北京时间**: 次日 00:00
- **功能**: IT资讯抓取、翻译、邮件发送、小红书发布
- **项目**: `/home/ubuntu/.nanobot/workspace/InformationCrawler/`
#### 5. **IT资讯自动化完整版** ⏰ 每天 16:00 (UTC)
```
0 16 * * * /bin/bash /home/ubuntu/nanocode/it_automation_enhanced/scripts/main_scheduler_complete.sh
```
- **北京时间**: 次日 00:00
- **功能**: 增强版IT资讯自动化(DeepSeek+邮件+小红书)
- **项目**: `/home/ubuntu/nanocode/it_automation_enhanced/`
#### 6. **小红书周数据分析** ⏰ 每周一 09:00 (UTC)
```
0 9 * * 1 /home/ubuntu/.nanobot/workspace/skills/xiaohongshu_integration/weekly_data_analysis.sh
```
- **北京时间**: 周一 17:00
- **功能**: 小红书数据分析和报告生成
- **日志**: `/home/ubuntu/.nanobot/workspace/xiaohongshu_logs/weekly_cron.log`
---
### 📊 **任务分类统计**
#### **按频率分类**
| 频率 | 数量 | 任务 |
|------|------|------|
| **每天执行** | 4个 | 小红书Cookie监控、热点趋势、IT资讯(2个) |
| **每周执行** | 2个 | 统一备份(周四)、周数据分析(周一) |
#### **按功能分类**
| 功能类别 | 数量 | 任务 |
|----------|------|------|
| **小红书相关** | 3个 | Cookie监控、热点趋势、周数据分析 |
| **IT资讯相关** | 2个 | IT资讯自动化(2个版本) |
| **系统维护** | 1个 | 统一备份系统 |
#### **按时间分布(UTC)**
| 时间 | 任务数量 | 具体任务 |
|------|----------|----------|
| **03:00** | 1个 | 统一备份(周四) |
| **08:00** | 1个 | 小红书Cookie监控 |
| **09:00** | 1个 | 小红书周数据分析(周一) |
| **10:00** | 1个 | 小红书热点趋势 |
| **16:00** | 2个 | IT资讯自动化(2个) |
---
### ⚠️ **需要注意的问题**
#### 1. **重复任务**
- **IT资讯自动化**有2个任务在**同一时间**执行:
- 原版:`main_scheduler_with_xhs_fixed.sh`
- 增强版:`main_scheduler_complete.sh`
**建议**:检查是否需要同时运行两个版本
#### 2. **注释行**
crontab中有多个注释行(#开头),这些是历史记录,不影响执行:
```
# IT资讯自动化系统 - 每天16:00执行
# IT资讯自动化系统完整版 - 每天16:00执行(包含DeepSeek+邮件+小红书)
# IT资讯自动化系统完整兼容版 - 每天16:00执行(邮件附件+小红书多图)
```
#### 3. **日志文件位置**
- 小红书相关:`/home/ubuntu/.nanobot/workspace/xiaohongshu_logs/`
- 统一备份:`/home/ubuntu/nanocode/backup_logs/`
---
### 🔍 **详细查看每个任务**
```bash
# 查看所有有效任务(排除注释和空行)
crontab -l | grep -v "^#" | grep -v "^$"
# 查看今天即将执行的任务
crontab -l | grep -v "^#" | grep -v "^$" | grep "* * *" | head -5
# 查看日志文件大小
ls -lh /home/ubuntu/.nanobot/workspace/xiaohongshu_logs/
ls -lh /home/ubuntu/nanocode/backup_logs/
```
---
### ✅ **当前cron配置的优点**
1. **时间分布合理**:任务分散在不同时间,避免集中执行
2. **功能覆盖全面**:内容发布、系统维护、数据分析都有
3. **日志记录完整**:每个任务都有日志输出
4. **备份系统完善**:新增的统一备份覆盖skill和记忆文件
### 🔧 **可优化建议**
1. **合并重复任务**:IT资讯自动化两个版本可能需要整合
2. **增加监控**:可以添加cron任务执行状态监控
3. **定期清理**:日志文件可能需要定期清理
需要我帮你检查某个特定任务的执行情况,或者调整cron配置吗?
完成!**3个任务已暂停(注释)**:
| 原时间 | 已暂停的任务 | 脚本路径 |
| ----- | ---------------------------- | ------------------------------------------------------------------------------------- |
| 10:00 | 小红书热点趋势自动化 | `/home/ubuntu/nanocode/xhs_trending_automation/scripts/scheduler.sh` |
| 16:00 | IT资讯自动化 (InformationCrawler) | `/home/ubuntu/.nanobot/workspace/InformationCrawler/main_scheduler_with_xhs_fixed.sh` |
| 16:00 | IT资讯自动化完整版 | `/home/ubuntu/nanocode/it_automation_enhanced/scripts/main_scheduler_complete.sh` |
---
**文件路径汇总**:
```bash
# 10:00 任务
/home/ubuntu/nanocode/xhs_trending_automation/scripts/scheduler.sh
# 16:00 任务(2个)
/home/ubuntu/.nanobot/workspace/InformationCrawler/main_scheduler_with_xhs_fixed.sh
/home/ubuntu/nanocode/it_automation_enhanced/scripts/main_scheduler_complete.sh
```
---
**恢复方法**(以后想恢复时执行):
```bash
# 取消注释(去掉行首的 #)
crontab -l | sed 's/^# \(0 \(10\|16\) \* \* \*.*\)/\1/' | crontab -
```
需要现在恢复吗?还是保持暂停?