语音通话短信助手
Clawdbot电话
本技能用于在Linux/macOS系统上配置和管理周期性任务,涵盖传统cron语法、crontab文件操作,以及现代systemd timer替代方案。支持时区处理、失败重试、运行日志查看和常见故障排查。
前置检查:确认系统已安装crontab或systemctl命令,支持Linux/Darwin环境。
快速开始:
crontab -e* * * * * echo "test" >> /tmp/cron-test.logcrontab -ltail -f /tmp/cron-test.logsystemd timer完整示例:
# 创建服务文件 sudo tee /etc/systemd/system/myjob.service << 'EOF' [Unit] Description=My scheduled job [Service] Type=oneshot ExecStart=/usr/local/bin/myscript.sh EOF # 创建定时器文件 sudo tee /etc/systemd/system/myjob.timer << 'EOF' [Unit] Description=Run myjob daily at 3 AM [Timer] OnCalendar=*-*-* 03:00:00 Persistent=true [Install] WantedBy=timers.target EOF # 加载并启用 sudo systemctl daemon-reload sudo systemctl enable --now myjob.timer systemctl list-timers
见下方输入与输出表格。
| 项目 | 内容 |
|---|---|
| 输入 | cron表达式、脚本路径、执行用户、环境变量、时区 |
| 输出 | 任务配置状态、执行日志、下次执行时间、失败通知 |
| 适用人群 | 系统管理员、自动化开发工程师、DevOps运维、故障排查人员 |
| 不包含 | Windows计划任务、分布式调度、容器cron、秒级调度 |
crontab -r会清空所有任务且无确认提示原始链接:https://github.com/openclaw/skills/tree/main/skills/gitgoodordietrying/cron-scheduling/SKILL.md
来源类型:GitHub仓库文档