Cron作业在特定时间启动和停止 [英] Cron job start and stop at certain time
问题描述
是否可以设置cron作业只在晚上在某些日子工作,例如,每个月的第一天从下午03点到晚上9点?
仅在晚上服务器负载较低时才执行电子邮件活动。
可以在特定时间运行cron作业,并在特定时间停止?
您可以在09pm使用第二个cron作业来启动第二个程序, p>
有很多方法可以做到这一点。最简单的一个可能是让第二个程序在方便的地方触摸 terminate.txt
。在第一个程序的每个循环,它可以检查这个文件。如果存在,它可以删除该文件,然后正常退出。
Is it possible to setup a cron job to work on certain days only at night, for example, the first day of each month from 03pm to 09pm?
I want to do an email campaign only at night when the server load is low.
Is it possible to run a cron job at a certain time and stop it at a certain time?
You could use a second cron job at 09pm to start a second program that tells the first program to terminate.
There are a number of ways to do this. One of the easiest might be to have the second program touch terminate.txt
in a convenient place. On each loop of the first program, it could check for this file. If it exists, it could delete the file and gracefully exit.
这篇关于Cron作业在特定时间启动和停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!