Earth 2 Eddie
Earth 2 Eddie

Reputation: 51

Setting up a scheduled job for a NodeJS script to run

I need a NodeJS script I wrote to run every 10 minutes and grab data from an API. I used to be a Unix admin and something like this would be accomplished with a cron job. I know I'm going to have to set up some kind of scheduled execution on the server where my script resides. What's the best way to approach this?

Upvotes: 0

Views: 56

Answers (1)

Parth Mahajan
Parth Mahajan

Reputation: 136

I think node-cron would solve your problem.

I know I'm going to have to set up some kind of scheduled execution on the server where my script resides

If you have just one script as of now and you are looking to NOT have many then you can simply place your scripts in your main repository itself with its own configurations. Alternatively, you can setup a whole new repository just for your scripts which would give you a lot more power over how you want to run your scripts, what language you want to write them in, who can access you code etc.

Upvotes: 1

Related Questions