Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Santiago Gimeno
      "name": "tmp",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "dependencies": {
        "browserify": "^13.0.0",
        "node-schedule": "^1.1.0"
      "devDependencies": {},
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      "author": "",
      "license": "ISC"
    var schedule = require('node-schedule');
    schedule.scheduleJob('* * * * 0', function() {
    run npm install
    node_modules/.bin/browserify index.js > bundle.js
    then include the bundle.js in the browser and see how it goes
    sorry i crashed my browser i will try this
    @santigimeno doesnt work :(
    Santiago Gimeno
    what problems are you observing?
    nothing is happening
    it looks like node-schedule gets loaded but still doesnt work for some reason schedule.scheduleJob returns {"callback":false,"name":"<Anonymous Job 1>","_events":{}}
    @santigimeno if i do console.log(JSON.stringify(require('node-schedule'))); i get {"scheduledJobs":{}} so something is happening
    Santiago Gimeno
    I don't know, I can test it right now, will try to do it later
    ok nice. thanks.
    Santiago Gimeno
    @plexigras change the cron expression to * * * * * * and see if the Job is printed in the browser console
    it is working. thanks
    @santigimeno now i get an error setImmediate is not defined
    Ivan Marban
    hi guys ! I've got an strange situation with a cron task that I have...
    maybe could clarify me if I have something wrong...
    I have a schedule task: var scraperRule = new schedule.RecurrenceRule(); scraperRule.minute = new schedule.Range(0, 50, 1);
    I want to execute on 50 sec of every minute... but I realized that is not executing the task from minute 50 to 0 of every hour...
    Is there any wrong with that ? or maybe I misunderstand recurrencerule...
    Ivan Marban
    :astonished: I figured it out myself.. I'm using a minute rule... This is what I was looking for: var scraperRule = new schedule.RecurrenceRule(); scraperRule.second = 50;
    Max Xu
    what time zone does the cron job run on? local machine time?
    Santiago Gimeno
    @xumx ATM yes, we're trying to add TZ support. I hope, soon
    Tyler Long
    any documentation available? for example, how to cancel a scheduled job?
    Abhinav Mall
    How do I unit test the scheduled jobs?
    I wrote a simple node app to schedule fours jobs for my rpi project. I want to write unit test for the same. https://github.com/abhinavmall/aqualightsrpi/blob/master/index.js
    Hi there guys, have a small questions here, if I have a recurring job:
    How do I know how much time left until it fires?
    Chris Rutherford
    Question, do I have to set the schedule as the value of an object like var x = schedule.scheduleJob(......); or can I just call schedule.scheduleJob(); and it will run? If assigning to a variable, should I also call it with x(); later?
    Ulrich DOHOU
    Hello. Is there a way to know when the cron finishes ?
    hello there
    can i create the dynamic schedules(dates) what i get from db or json
    Rana Hamza Khursheed

    Hello everyone!


    I want to schedule a job to run exactly once at 6pm on a specific date say (04-Nov-2019) and then every day after that at 6pm.

    Rana Hamza Khursheed
    @cjrutherford you can schedule a job by just schedule.scheduleJob(); but if you assign it to variable then later you can use that variable to cancel the event.
    hey can someone help me with binding ? i seems odd to attach it to the code block of the function and i cant seem to get it to work that way
    espacially whe used in an enviorment like modules.exports
    Agboola Jude

    Hi Devs!

    Please, I need help! Is there any way to assign an ID to a cronjob so it can be deleted/ modified at any time?

    Charles Read
    Hi, all, can I use the tz configuration parameter with scheduleJob?
    Charles Read
    From what I can tell the tz configuration parameter is only used with a RecurrenceRule, where it seems I cannot use a crontab string, but I'd like to use a crontab string and specify a timezone
    Hello anybody can help me?
    Satish Adabala

    Hi, does anyone know why the below schedule is running at every minute in addition to every 25secs.
    */25 * * * * *

    {"schedule":"*/25 0-59 * * * *", "scheduledTime":"2020-11-01T22:29:25.000Z"}
    {"schedule":"*/25 0-59 * * * *", "scheduledTime":"2020-11-01T22:29:50.000Z"}
    {"schedule":"*/25 0-59 * * * *", "scheduledTime":"2020-11-01T22:30:00.000Z"}
    {"schedule":"*/25 0-59 * * * *", "scheduledTime":"2020-11-01T22:30:25.000Z"}
    {"schedule":"*/25 0-59 * * * *", "scheduledTime":"2020-11-01T22:30:50.000Z"}
    {"schedule":"*/25 0-59 * * * *", "scheduledTime":"2020-11-01T22:31:00.000Z"}

    If that is the expected behaviour how can I run my job just after every 25seconds instead of resetting the schedule at every minute.

    Rakshit Kumar
    Hey guys. I have a question. Is there a way I can create jobs and group them for particular users(say using an array of dictionaries with the key as user id and value as an array of jobs)? And can I assign names to jobs to identify them? It will help me a lot if that's possible. If not, how should I tackle these two problems?
    Rakshit Kumar
    @marvinjude I have the same question. Were you able to figure something out?

    hi, for some reason when creating a job like

    var j = schedule.scheduleJob(new Date(date)...

    it returns null when console logging

    does anyone know why this is?

    Norman Gao
    I have a problem when I use use this package like "Schedule.scheduleJob('0 30 1 ?', somethingToDo)" . it would works correctly on node 10.16, but it not work correctly on node 12.0.* do you guys met the same problem before ?