with one click
cron
crontab 表达式语法、常见调度、输出重定向、调试技巧、环境变量
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
crontab 表达式语法、常见调度、输出重定向、调试技巧、环境变量
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
生成或审计模块的 SPEC.md。使用场景:用户要求"给 XX 模块写 spec"、"审计所有 spec"、"检查 spec 是否过期"。
Automates SailFish release workflow: fix build/type errors, update CHANGELOG (EN + CN), run npm version with pre/post hooks. Use when the user asks to release, 发版, 发布, bump version, or update changelog.
后端代码修改后,通过 CLI 测试验证功能正确性。使用场景:修改了 electron/services/ 下的代码需要测试、准备提交代码前跑回归、用户要求"跑测试"/"验证一下"。
完成新功能开发或较大修改后,使用本机 Claude CLI 进行代码审查。
使用 ts-morph 静态分析工具查询代码结构(类层次、方法签名、引用、依赖等),替代手动读源码。使用场景:需要了解类的方法/属性、继承链、符号引用、文件结构、依赖关系时。
When committing or staging changes, only include files related to the current task or conversation; do not stage or commit unrelated modifications. Use when the user asks to commit, stage, 提交, or when preparing to run git add/commit.
| name | Cron 定时任务 |
| description | crontab 表达式语法、常见调度、输出重定向、调试技巧、环境变量 |
| version | 1.0 |
编写和调试 cron 任务的最佳实践。
分 时 日 月 周 命令
0-59 0-23 1-31 1-12 0-7
周:0 和 7 均为周日;或用 mon、tue 等名称。
# 每天 2:00
0 2 * * * /path/to/script.sh
# 每小时
0 * * * * /path/to/script.sh
# 每 5 分钟
*/5 * * * * /path/to/script.sh
# 每周一 9:00
0 9 * * 1 /path/to/script.sh
# 每月 1 号 0:00
0 0 1 * * /path/to/script.sh
# 丢弃所有输出
0 2 * * * /path/script.sh > /dev/null 2>&1
# 输出到日志
0 2 * * * /path/script.sh >> /var/log/cron.log 2>&1
# 错误单独记录
0 2 * * * /path/script.sh >> /var/log/out.log 2>> /var/log/err.log
cron 环境极简,不含 PATH、HOME 等,需显式设置:
SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
MAILTO=admin@example.com
0 2 * * * cd /app && /usr/bin/node script.js
或在脚本内:export PATH=/usr/local/bin:$PATH。
/path/to/script.sh 确认可用* * * * *echo "$(date): started" >> /var/log/cron.loggrep CRON /var/log/syslog(Debian/Ubuntu)或 journalctl -u crond