I'm doing a process with nodejs
and I need to run say at every hour without needing to continually do something like node app.js
. The script could have for example a console.log('ejecutar a cada hora')
. Now, I was thinking about doing:
setInterval(function(){
console.log('ejecutar a cada hora');
}, 3600);
and just run it with pm2
, but I do not like the idea of using setInterval
Any alternative solution?
I'm looking for something like:
pm2 app.js --interval 3600
It is not necessary that it be with pm2
although it would be ideal.