Using systemd and launchd to run Node.js in the background

Jamie Munro
Jul 26, 2017 · 1 min read

When you are developing and testing your application, it’s ok to constantly start the Node.js server; however, once you’ve finished or you are trying to setup a production web server you want the Node.js service to always be running in the background. Let’s explore the variety of ways to accomplish this.

To run Node.js as a background service you can leverage the systemd for most Linux distros. For OSX you can leverage launchd.

You will need to create one file per application you wish to run.

Read the full examples for running Node.js as a background service for either Linux or OSX based on your requirements.

Jamie Munro
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade