【发布时间】:2020-09-03 13:29:16
【问题描述】:
我对整个编程很陌生,如果这个问题看起来有点愚蠢,我很抱歉。 我的程序有多个计划在特定工作日的特定时间运行的 cron 作业。这基本上是一种自动化学校时间表的尝试。
每当我的 Mac 进入睡眠状态或我合上盖子时,只要它关闭,程序就会延迟(如果它睡着 5 分钟,它将延迟 5 分钟)。我不知道 cron 或 launchd 是如何真正处理这个问题的,我也没有找到关于这个问题的任何其他线程。
这是代码示例:
var mondayTwo = new CronJob('00 59 09 * * 1', function(){
doAll(la);
}, null, true, 'timezone');
mondayTwo.start();
var tuesdayTwo = new CronJob('00 59 09 * * 2', function(){
doAll(science);
}, null, true, 'timezone');
tuesdayTwo.start();
var wednesdayTwo = new CronJob('00 59 09 * * 3', function(){
doAll(la);
}, null, true, 'timezone');
wednesdayTwo.start();
var thursdayTwo= new CronJob('00 59 09 * * 4', function(){
doAll(la);
}, null, true, 'timezone');
thursdayTwo.start();
var fridayTwo = new CronJob('00 59 09 * * 5', function(){
doAll(math);
}, null, true, 'timezone');
fridayTwo.start();
程序使用节点提示来获取链接,但效果很好,所以我不知道是什么导致了问题
【问题讨论】: