如何每2小时运行一次cron作业? [英] How to run cron job every 2 hours?

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

问题描述

如何编写一个 Crontab 来每 2 小时运行一次我的 /home/username/test.sh 脚本?

How can I write a Crontab that will run my /home/username/test.sh script every 2 hours?

推荐答案

只需:

0 */2 * * *  /home/username/test.sh 

开头的 0 表示在第 0 分钟运行.(如果它是 *,则脚本将在每隔一小时内每分钟运行一次.)

The 0 at the beginning means to run at the 0th minute. (If it were an *, the script would run every minute during every second hour.)

别忘了,你可以检查系统日志,看看它是否真的运行过!

Don't forget, you can check syslog to see if it ever actually ran!

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

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