3 ms·
"Simply starting node on your server is a recipe for disaster. If it crashes (and at some point it will, node code is perfect), your service will be wiped of th
by kronholm 14y ago
"Simply starting node on your server is a recipe for disaster. If it crashes (and at some point it will, node code is perfect), your service will be wiped of the internet."
The solution to that in the article seems an awful lot of trouble. You can just use the following in your script to keep it from crashing/exiting whenever there's an exception, warning or whichever:
process.on('uncaughtException', function (err) {
//do stuff
});
I've used that in a few projects, where it usually sends me an email if something goes wrong. (npm: mailer).
- rubenv 14y agoThat assumes that node itself will never crash, or that your server will never reboot. Just keeping it running isn't the main point though: socket activation is great if you want to increase server density. And the whole-system monitoring + resource policies are very nice tools for system administrators. There's a lot more to systemd and node.js than simply running node.
- kronholm 14y agoGood to know, thank you - will definitely have to try it out then!