Skip to content
Discussion options

You must be logged in to vote

一些定时任务的例子:

每分钟执行一次命令

* * * * * myCommand

每五分钟执行一次

*/5 * * * * myCommand

每小时的第5分钟执行一次,是一个间隔一小时的任务

5 * * * * myCommand

每小时的第10到20分钟,每2分钟执行一次

5-10/2 * * * * myCommand

每天18 : 00至23 : 00之间每隔30分钟重启smb

0,30 18-23 * * * /etc/init.d/smb restart
*/30 18-23 * * * /etc/init.d/smb restart

每周六、周日的1 : 10重启smb

10 1 * * 6,0 /etc/init.d/smb restart

4月3号当天,每分钟执行一次

* * 3 Apr * {{command_to_execute}}

每周五的02:30分执行一次

30 2 * * Fri {{/absolute/path/to/script.sh}}

参考: 菜鸟教程

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@CongratulateWE
Comment options

CongratulateWE Sep 14, 2021
Maintainer Author

Answer selected by CongratulateWE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
1 participant