如何计划每隔午夜运行JavaScript代码 [英] how to schedule to run JavaScript code every midnight
问题描述
我要求每隔午夜计算一次文档库中的所有文件(以及文件名)。然后我将此信息插入列表中。我需要每个午夜都这样做。如何设置用于运行JavaScript代码的调度程序?
谢谢
faye fouladi
您好
< p style ="margin:0in 0in 0.0001pt; vertical-align:baseline"> 有 < a href ="https://www.npmjs.org/package/node-schedule"style ="font-style:inherit; font-variant:inherit; font-weight:inherit; line-height:inherit">
node-schedule package 已安装,这是您可以安排的调度程序,运行你的代码
使用 node-schedule :import 计划 'node-schedule'
schedule 。 scheduleJob ( '0 0 * * *' , () => { ... }) //每天午夜运行
请参阅..
https://stackoverflow.com/questions/26306090/running-a-function-everyday-midnight
I have a requirement to get a count of all files in my document library (and the file names) every midnight. I then insert this information into a list. I need to do this every midnight. How can I setup a Scheduler for running JavaScript code?
Thanks
faye fouladi
Hi
Have the node-schedule package installed , this is your scheduler where you can schedule and run your code
With node-schedule:
import schedule from 'node-schedule'
schedule.scheduleJob('0 0 * * *', () => { ... }) // run everyday at midnight
Refer this..
https://stackoverflow.com/questions/26306090/running-a-function-everyday-midnight
这篇关于如何计划每隔午夜运行JavaScript代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!