全球主机交流论坛

标题: 想用crontab每小时执行一次命令,这两个命令到底用哪个? [打印本页]

作者: 腾讯云6折购    时间: 2023-1-7 20:54
标题: 想用crontab每小时执行一次命令,这两个命令到底用哪个?
* */1 * * * /etc/init.d/smb restart


0 */1 * * * /etc/init.d/smb restart


这两个哪个是正确的? 注意标红的地方
作者: sunlight    时间: 2023-1-7 20:55
0 */1 * * *
一般都会先用 https://crontab.guru/ 去检查
作者: 莆田郑少斌    时间: 2023-1-7 20:56

作者: Salta    时间: 2023-1-7 20:59
1 * * * * * /etc/init.d/smb restart
不应该是这样吗,?
作者: J0rmo    时间: 2023-1-7 20:59
0 * * * * /etc/init.d/smb restart

这样不就行了吗
作者: a4425656    时间: 2023-1-7 21:01
* * 0/1 * * ?  这样子吧
作者: 宣传    时间: 2023-1-7 21:08
https://tooltt.com/crontab/c/29.html
作者: adamlau    时间: 2023-1-7 21:11
0 * * * * 二楼正解
作者: auto8624    时间: 2023-1-7 21:16
0 * * * *
0 */1 * * *
作者: hchen    时间: 2023-1-7 21:21
https://crontab.guru/#0_*/1_*_*_*
  1. 0 */1 * * *
  2. next at 2023-01-07 22:00:00
  3. then at 2023-01-07 23:00:00
  4. then at 2023-01-08 00:00:00
  5. then at 2023-01-08 01:00:00
  6. then at 2023-01-08 02:00:00
复制代码





欢迎光临 全球主机交流论坛 (https://loc.daji.eu.org/) Powered by Discuz! X3.4