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
3
votes
1 answer

Node-cron: Wait for job finished to execute the next one

I am using the package "cron": "^1.7.1". I want to finish a task that can take longer than the scheduled cron-job. Find below my minimum viable example: const CronJob = require('cron').CronJob; console.log('Before job instantiation'); const job3 =…
Carol.Kar
  • 4,581
  • 36
  • 131
  • 264
3
votes
1 answer

Reset timer for already running cron-node job

I need to run a scheduler every 5 min which will do few http calls . After first time I want to start the next timer only when all the http calls are finished. How can I do this cannot find the solution on 'node-cron' documentation. This is how I am…
johnwick
  • 31
  • 2
3
votes
1 answer

node-cron not executing script on interval only console.log

On initial run, it'll run app.js however, on interval it skips over it. What might I be doing wrong here? var cron = require('node-cron'); cron.schedule('*/10 * * * * *', function(){ var shell = require('./app.js'); commandList = [ …
CodeSpent
  • 1,684
  • 4
  • 23
  • 46
2
votes
1 answer

@nestjs/schedule throw Error: Unknown alias: fal

I have a nestjs project which runs scheduled tasks, but when I try to run it on Ubuntu 22.04, it throws an error when starting the application. This is the error Error: Unknown alias: fal. Stacktrace below Error: Unknown alias: fal at…
AshanPerera
  • 596
  • 1
  • 7
  • 18
2
votes
0 answers

How to send email for a particular scheduled date and time ? [Schedule Email Feature]

I tried cron jobs for scheduling but it gets triggered for each and every day at that particular time. Also workaround Gmail API for scheduling, but there isn't a feature in Gmail API My requirement is to send a scheduled email for the given time by…
2
votes
0 answers

NestJS Application rebuild without affecting current running process

I am using NestJS cron in my REST API application but I have a question. How can I stop cron without interrupting the cron that are currently running todo a new build to apply new changes into the code? For Example: import { Injectable, Logger }…
2
votes
2 answers

How to Run a Cron Job when the code is in Other File - Node JS

I am trying to execute a cron every 1 hour. For which I have initiated the cron job in my index.js file as below const cron = require('node-cron'); const readDocuments = require("./cronJobs/readDocuments"); var task = cron.schedule('0 0 */1 * * *',…
2
votes
2 answers

NestJs Using Environment Configuration on @Cron decorator

I am building a nestJs application, with scheduling and configuration. I want to be able to configure my Cron with my environment variable but it does not seems to work. app.module.ts : @Module({ imports: [ ConfigModule.forRoot(), …
Antoine Grenard
  • 1,712
  • 3
  • 21
  • 41
2
votes
1 answer

How to list the node cron's scheduled jobs

I am using node-cron package to schedule a job. I wanted to know the internal behavior of it in windows server. In documentation I can see this The actions of cron are driven by a crontab (cron table) file, a configuration file that contains…
Mukun
  • 147
  • 1
  • 13
2
votes
1 answer

Cron Job executes multiple times till the entire minute is completed,

I use the node-cron npm package to run a job that should execute only ONCE every 5 minutes However , the output i get is that the job executes continously till the entire minute is complete,it executes more than once. cron.schedule('*/5 * * * *',…
2
votes
3 answers

Run cron job every 10, 20, 30, 40, 50, 60 minute of every hour in node js

I'm using node-cron to use cron. Here is what I have done so far - cron.schedule('10 * * * *', cronJobController.sendReminderNotification, { scheduled: true, timezone: 'Asia/Kolkata' }); cron.schedule('20 * * * *',…
amM
  • 509
  • 2
  • 14
  • 33
2
votes
1 answer

Run node cron every O'clock hour

I have below node cron setup that runs every hour. const { CronJob } = require('cron'); const Job1 = new CronJob('0 0 */1 * * *', (async () => { let response = await fetch(`${BASE_URL}/todo`); response = await response.json(); …
Magnetaar
  • 51
  • 6
2
votes
2 answers

How to send res to my client using cron jobs

I have cron jobs launch when server start that watch and start an appointment when it's time come but I want to send data to my client through response ,is that possible in cron jobs I am working with NodeJS and sails crons.schedule("* * * * * *",…
mohamed nageh
  • 593
  • 4
  • 9
  • 26
2
votes
2 answers

Telegram bot - Sending messages to user every day

I would like to create a Telegram bot based on Telegraf. I want the bot to schedule and send messages to users by launching a command. For instance, I want it to work as a course: once you select a course, you get lessons every day. I tried using…
Paul
  • 324
  • 5
  • 13
2
votes
3 answers

How to write cronjobs in seperate file nodejs

I want to write a cron job on node.js which runs every minute. The tutorials that I viewed online all showed the cron job being written in the "App.js" or "server.js" file which is the main file on nodejs. I want to seperate this into another file…
Zain Samin
  • 67
  • 1
  • 6
1
2
3
13 14