hitwill
hitwill

Reputation: 623

How can I re-run a node.js script as soon as it is completed?

I have a worker.js script that takes a variable amount of time to complete. As soon as it is finished running, I would like to restart it immediately.

One option is to use a cron job and a lock file to prevent multiple instances of the script from running. However, there must be a cleaner way to re-run worker.js as soon as it is completed?

Upvotes: 0

Views: 1464

Answers (1)

hitwill
hitwill

Reputation: 623

I managed to do this using forever-monitor. As soon as the process exits at a variable time, forever simply restarts it programatically

Upvotes: 2

Related Questions