如何每36小时运行一次crontab [英] How to run crontab for every 36 hours

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

问题描述

我正在使用php创建自动cron选项卡。我需要在以下时间运行此cron选项卡。

I am creating Automated cron tab using php. i need to run this cron tab for following times.

24小时或
36小时或
48小时或
72小时或
96小时。

24 hours or 36 hours or 48 hours or 72 hours or 96 hours.

我很困惑在cron选项卡中设置36小时。

i am confused to setup in cron tab for 36 hours.

如何设置每36个小时运行一次的cronjob?请告知

How do I set up a cronjob that runs every 36th hours? Please Advise

推荐答案

这不是一个很好的解决方案,但是...

It's not a great solution, but...

设置cron作业以每12小时运行一次脚本。在脚本中,添加以下内容:

Set the cron job up to run the script every 12 hours. In the script, add something like:

$hour_of_year = date('z') * 24 + date('H');

if ($hour_of_year % 36 == 0) {
    // RUN THE PROGRAM

} else {
    // DONT RUN THE PROGRAM
}

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

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