每六个小时在Linux上运行一次cron作业 [英] Running a cron job on Linux every six hours

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

问题描述

如何每天每六个小时运行一次命令?

How can I run command every six hours every day?

我尝试了以下操作,但没有用:

I tried the following, but it did not work:

/6 * * * * *  mycommand


推荐答案

您忘记了 * ,并且您有太多字段。这是您需要关心的时刻

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

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

这意味着每6小时从0开始,即您可以写为0、6、12和18的时间

This means every sixth 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

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

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