在 Debian 系统中,定时任务通常是通过 cron 服务或 Systemd 定时器 来实现的。以下是几种常见的使用案例:
0 3 * * * /path/to/your/script.sh
0 * * * * /path/to/your/script.sh
0 10 * * 1-5 /path/to/your/script.sh
[Unit]
Description=Download and process popcon data
[Timer]
OnCalendar=Thu*-*-* 05:32:07
Persistent=true
[Install]
WantedBy=basic.target
[Unit]
Description=Run minetest service between 17:00 and 19:00
[Timer]
OnCalendar=*-*-* 17:00:00
OnBootSec=1h
Persistent=true
[Install]
WantedBy=basic.target
通过这些使用案例,可以看出 Debian 定时器在自动化任务调度和管理中的强大功能,能够满足从简单周期性任务到复杂条件触发的多种需求。