Questions tagged [node-cron]

The node-cron module is tiny task scheduler in pure JavaScript for node.js based on GNU crontab. This module allows you to schedule task in node.js using full crontab syntax.

198 questions
1
vote
3 answers

Node cron task not working after app running for a while (node-cron, cronr, timexe)

I am trying to leave a node application with a cron job running on my laptop and it seems to work if I start the app not long before the job has to actually run. What I mean by this is if, for example, I set a job to run at 2:05 pm and I start the…
milanesa
  • 33
  • 2
  • 6
1
vote
1 answer

Node js Cron Job execution after 14 days

cron.schedule(5 4 */14 * *){} Is there any way to make it so it executes continously after 14 days without a reset?
Ken S Musima
  • 25
  • 1
  • 4
1
vote
0 answers

How to run crone job every hour and minute

I would like to schedule a job to fetch users from other server. I would like every hour and minute specified. For that, I have used node-cron. For example: If I specify 2h and 5min, I would like my job to run like: Start - 13H 14h 05m -next 16h…
Loki
  • 1,064
  • 2
  • 26
  • 55
1
vote
1 answer

Node-Cron: how to ensure last job is complete

I am using node-cron to send operational emails (currently searching for new emails that need to be sent every minute). My function (operationalEmails) looks for mongodb records that have a sent flag = false, sends the email, then changes the sent…
Josh J
  • 59
  • 7
1
vote
0 answers

How to prevent code from excecuting multiple times

This code ends up spamming messages for one second every time it runs. Does anyone know to prevent that? the variable count is the amount of messages sent in the last hour, and my goal is if more then 15 were sent in the past hour then to send a…
Mighty
  • 11
  • 2
1
vote
0 answers

Mongodb failing to handle multiple saves in short amount of time

I have a nodejs-cron based application that sends automated scheduled requests in order to update some fields in a mongodb document (I am using mongodb atlas). My application are sending over 200 requests within a 15-20 minutes time lapse, and only…
John doe
  • 3,680
  • 7
  • 31
  • 65
1
vote
0 answers

Node cron only excute specified date and stop completely after excute success

I have this code: var cron = require('node-cron'); var task = cron.schedule('0 36 17 10 SEP 4 2020', () => { console.log('will execute'); }); This code run console.log('will execute') at 17:00:00 10 Sep 2020 and I run success. But I think…
Java Dev Beginner
  • 349
  • 1
  • 5
  • 14
1
vote
0 answers

Stopping and starting execution of cron-job-manager (node-cron) upon condition

So, I found an old question about this (here: How to stop a node cron job) but it doesn't work for me (and I can't realize the reason why). I'm using cron-job-manager (since I plan to use more than one scheduled job at the same time) but as far as I…
1
vote
0 answers

TSC exporting node-cron modules as ["default"] giving schedule() undefined

not sure if its a problem in node-cron or in the way that tsc translate the code. The thing is, when you try to export a ts file using node-cron, TSC converts: import express = require('express'); import cron from 'node-cron' const app =…
Neoligero
  • 37
  • 1
  • 4
1
vote
0 answers

JavaScript Discord Bot Update Channel Name

I'm having some unexpected results when trying to set the name of a channel to the current UTC time. The below code runs but only updates the channel name every ten minutes (it tries every 30 seconds without error). When it does update the channel…
1
vote
0 answers

how can I set UTC timezone in cron job

I have tried using this code, but it didn't work,it should run when UTC time 1 pm and according to IST time 6:30 pm, but it is not working at that time Versions are mentioned below Node - 10.16.0 node-cron - 2.0.3 cron.schedule('0 0 13 * * *', () =>…
Rinkal Gohel
  • 11
  • 1
  • 4
1
vote
0 answers

Begin running cron job on npm prestart

I need to begin a cron job every time before I start my app. So in my package.json, I have the following scripts: "prestart": "node ./scripts/pre-start", "start": "node server.js", This is my prestart script: var CronJob =…
theJuls
  • 6,788
  • 14
  • 73
  • 160
1
vote
4 answers

Getting "npm ERR! code ELIFECYCLE npm ERR! errno 126" while running npm install

I am trying to run npm install on my server and getting this error. > node-cron@2.0.3 postinstall /home/workspace/AgreementCancellationProd/retrymechanism/node_modules/node-cron > opencollective-postinstall /usr/bin/env: node: Permission denied npm…
writeToBhuwan
  • 3,233
  • 11
  • 39
  • 67
1
vote
0 answers

Node JS cron script with Promises

I'm pretty new to the JavaScript promises. I'm trying to make a script to calculate efficiencies for each machine of a client and the cases I need to handle is has there been a die change in the shift and if so how many. Now, each die has a…
1
vote
2 answers

Synchronous api calls in Node.js

I've a cronjob that runs every 10 secs. It requests for machines for a single client and does computation based on the response and then has to update or create documents with those computations in a for loop. But, the api calls after '***' in the…
Jayesh Rohira
  • 77
  • 2
  • 8