Function that executes in scheduled time

1

How to create a function that is executed for example every 5 minutes in nodejs.

I found the lib: link but I do not know how to make it run always, and not just once

    
asked by anonymous 27.09.2016 / 05:23

1 answer

0

I use the cron lib and it has worked very well.

But you can also do this with pure JavaScript, just use the setInternal function.

setInterval(function () { 
  console.log('Isto aqui vai ser executado a cada 5 minutos'); 
}, 5 * 60 * 1000); //300.000, o que corresponde a 5 minutos
    
05.11.2016 / 13:44