Linux设置周期性计划任务

在终端输入 crontab -e

选择编辑器 /usr/bin/vim.tiny

每分钟执行一次 hello.py 文件 * * * * * python3 .../hello.py

分时日月周
    分 :0-59
    时 :0-23
    日 :1-31
    月 :1-12
    周 :0-6

,指定时间点

/指定时间间隔

-指定时间段

*/10 * * * * 表示每10分钟执行一次命令

* * 1,5 * * 表示每月的1日和5日两天

0 0-6/1 * * * 表示0点~6点每小时执行一次命令

每小时的第3分钟和第15分钟执行  3,15 * * * * python3 .../hello.py

每周六、周日的0点执行  0 0 * * 6,0 python3 .../hello.py

每天18:00到23:00之间每小时执行  0 18-23/1 * * * python3 .../hello.py

猜你喜欢

转载自blog.csdn.net/q354636996/article/details/82668603