定时任务

作者:iohannes 发布时间: 2025-07-22 阅读量:7

定义脚本

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
# to do something

脚本可运行

chmod +x /bash/path/run.sh

添加到定时任务

crontab -e
15 2 * * * /bash/path/run.sh
  • 每天 02:15 执行