crontab 每分钟的写法

2013-10-23 18:28:23 +08:00
 582033
难道不是 */1 * * * * 么
4914 次点击
所在节点    问与答
7 条回复
Livid
2013-10-23 18:29:10 +08:00
* * * * * command
582033
2013-10-23 18:42:48 +08:00
原来是因为crontab无法直接执行bashrc中的环境变量...
sophy
2013-10-23 18:55:57 +08:00
@582033 command要写绝对路径
kfll
2013-10-23 20:12:23 +08:00
man 5 crontab
pubby
2013-10-23 20:29:25 +08:00
写法没错的

个人碰到过crontab唯一坑的地方是
day of month 和 day of week都指定的话,是任意一个满足就会执行,而不是两个都满足才执行。

Note: The day of a command's execution can be specified by two fields —
day of month, and day of week. If both fields are restricted (ie, are
not *), the command will be run when either field matches the current
time. For example, ``30 4 1,15 * 5'' would cause a command to be run at
4:30 am on the 1st and 15th of each month, plus every Friday.
wzxjohn
2013-10-23 22:22:26 +08:00
*/1 * * * *

* * * * *
均可
awanabe
2013-10-24 17:53:06 +08:00
楼主运行crontab的时候最好把log输出到一个文件中....用于调试和记录--

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/86648

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX