0

Possible Duplicate:
How to exit in Node.JS

I'm using node.js to import some data in the background and I'll have the script running every other day in the background using cron. I don't need it to listen. How do I exit the node script after it runs? Should I use process.exit() or is there a better way?

1
  • 4
    It will end automatically when there is no more to do. Commented Sep 20, 2012 at 14:33

1 Answer 1

2

If it's not bound to a database or listing on a port it will automatically close. If you are connected to a database and need to shut down the process then use process.exit(); after cleaning up the connections.

Sign up to request clarification or add additional context in comments.

1 Comment

Close the connection to the database properly and do not use process.exit().

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.