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

查看:22
本文介绍了每六个小时在 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

这意味着从 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天全站免登陆