-1

I am using a node.js/express.js script to scrap data from a website. The data I need are generated on a daily basis, so I need my script to launch automatically everyday at a given hour.

Is there a way to do that?

Mahmoud
  • 31
  • 3
  • What type of server is your script running on (V-/Root-Server, some NodeJs hosting, your local machine, something else?)? If you're on a Unix/Linux environment you might look for "Cronjobs" – try-catch-finally Dec 23 '14 at 13:31
  • I am using Wamp Server on Windows to run my script on my local machine – Mahmoud Dec 23 '14 at 13:35

2 Answers2

1

This isn't a node problem, you just need to launch the script (like any other) on a regular basis. On linux/mac, it's via cronjobs, on windows it's via schtasks

All available commands can be found here: http://technet.microsoft.com/en-us/library/cc772785%28WS.10%29.aspx

Or you can use the windows "click around" way:

http://windows.microsoft.com/en-us/windows/schedule-task#1TC=windows-7

Xavier
  • 1,157
  • 9
  • 29
1

if you are on linux and you want do it using only node js, you can use node-schedule.

 schedule.scheduleJob({hour: 14, minute: 30, dayOfWeek: 0}, function(){
    console.log('Time for tea!');
});
radar155
  • 1,796
  • 2
  • 11
  • 28