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?
asked Sep 20, 2012 at 14:14
jabbermonkey
1,8304 gold badges20 silver badges38 bronze badges
-
4It will end automatically when there is no more to do.Mattias– Mattias2012年09月20日 14:33:53 +00:00Commented Sep 20, 2012 at 14:33
1 Answer 1
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.
surendrapanday
5584 silver badges14 bronze badges
answered Sep 20, 2012 at 16:57
Jason Brumwell
3,55027 silver badges18 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
user3427419
Close the connection to the database properly and do not use
process.exit().lang-js