Node.js pm2上的节点cron计划有时会多次触发,但并非总是如此
我已通过Node.js pm2上的节点cron计划有时会多次触发,但并非总是如此,node.js,pm2,node-cron,Node.js,Pm2,Node Cron,我已通过节点cron设置了计划任务。我已经让它在后台运行了pm2 我计划每天运行一次。它每天运行一次,持续几天,但有时运行多次 你知道这件事吗 sched_exec.js "use strict"; const cron = require("node-cron"); const express = require("express"); const fs = require("fs"); const sync_m
节点cron
设置了计划任务。我已经让它在后台运行了pm2
我计划每天运行一次。它每天运行一次,持续几天,但有时运行多次
你知道这件事吗
sched_exec.js
"use strict";
const cron = require("node-cron");
const express = require("express");
const fs = require("fs");
const sync_module = require('./sync');
const logwriter = require('./logWriter/logwriter');
const app = express();
// schedule tasks to be run on the server
const exec_timing = "0 2 * * *";//prod
//const exec_timing = "12 21 * * *";//test
cron.schedule(exec_timing, function() {
logwriter.info("start scheduled task");
sync_module.sync(false);
});
app.listen(3128);