每6小时在linux上运行cron作业 [英] Running cron job on linux every 6 hours

查看:361
本文介绍了每6小时在linux上运行cron作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何每天6小时运行命令?尝试不起作用:

  / 6 * * * * * mycommand 
pre>

解决方案

您忘记了 * 字段,这是您需要关心的时间

  0 * / 6 * * * / path / to / mycommand 

这意味着从0开始每隔6小时,即在0,6,12和18小时,

  0 0,6,12,18 * * * / path / to / mycommand 


How can I run command every six hours every day? Tried this not working :

/6 * * * * *  mycommand

解决方案

You forgot a * ,and you've too many fields, and it's the hour you need to care about

0 */6 * * * /path/to/mycommand

This means every 6th hour starting from 0, i.e. at hour 0, 6, 12 and 18 Which you could write as

0 0,6,12,18 * * * /path/to/mycommand

这篇关于每6小时在linux上运行cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆