如何每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
}