简体   繁体   English

在Linux / Apache上在后台运行Cron Job

[英]Run Cron Job in Background on Linux/Apache

I have a cron job I need to run every 7 days to aggregate up a bunch of data using a php script. 我有一份Cron作业,我需要每7天运行一次,以使用php脚本汇总一堆数据。 The process is pretty CPU intensive and can take a decent amount of time. 该过程占用大量CPU,可能会花费大量时间。 Despite setting it to run at 4 am (when we get the least amount of traffic) users are starting to notice some down time when the script runs. 尽管将其设置为在凌晨4点(当我们获得最少的流量时)运行,但用户在脚本运行时开始注意到一些停机时间。 Is there a way to run this in the background only when the CPU is not being used or has an open thread? 仅当不使用CPU或线程处于打开状态时,才可以在后台运行此方法吗?

Thanks! 谢谢!

在cron作业行中,您可以使用“ nice”,“ chrt”或“ loadwatch”程序包装php命令行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM