以秒运行Crontab

在Liux或BSD下,Crontab可以实现以秒运行程序的。

格式如下:

1 minute 1
1,5 minutes 1 and 5
* any minute
*/5 any minute that is divisible by 5

1:2 second 2 of minute 1
1:2,5:10 second 2 of minute 1 and second 10 of minute 5
*:3 second 3 of any minute
*:*/5 any second that is divisible by 5

只是设置分钟那里跟平时的不大一样,其他部分一样。

4 条评论 »

  1. hawking said,

    五月 9, 2008 at 11:25 上午

    不对吧 我进过试验发现 1:2 ,1:2,5:10这种写法就是错误的啊 ?
    *:3这种写法虽然是对的 可是实际上却还是每分钟执行一次 并不能达到每3秒执行一次
    小弟才疏学浅 博主可以解释下吗?

  2. catch said,

    五月 18, 2008 at 9:23 下午

    是否支持秒级的Cron需要使用man 5 crontab看一下才行.如果支持的,那里会有相应的说明的.没有的话,需要升级一下Cron才行.

  3. pxczy said,

    二月 25, 2010 at 11:19 上午

    我这也不行啊,版本还算比较新

  4. Kim Chow said,

    二月 27, 2010 at 12:20 下午

    可以呀。

    是否你运行的了什么东西?

RSS feed for comments on this post · TrackBack URL

发表评论

You must be logged in to post a comment.