is good, but you don’t need another software to control background processes on your server! Forever Module One of the challenges in production is how to run Node.js services in background automatically restart them if they are crashing collect output/error logs for analyzing them later or watching them in a real time. All of them are similar to every long running application on server side, so the Linux community have that kind of tools natively integrated into almost every linux distribution. One of the latest tools for handling and processing long running background tasks/services is called , which is developed by Linux Foundation and now it became standard for Linux distributions. We will be focusing only on Ubuntu Server because it’s really easy to get started with it. SystemD What is actually a SystemD ? SystemD is an init system used in Linux distributions to bootstrap the user space and manage all processes subsequently — from Wikipedia This means that SystemD is actually developed to manage and execute User Space processes/services. You can schedule a job, start/stop/restart it and collect it using system logs. Base command to get started with it is which have all sub commands to manage existing services or to add exiting ones. systemctl Stop Talking! Let’s setup a project! To make this experiment more realistic, making very basic node.js http listener. hello world #!/usr/bin/env node /** server.js */ var http = require('http'); // Configure our HTTP server to respond with Hello World to all requests.var server = http.createServer(function (request, response) {response.writeHead(200, {"Content-Type": "text/plain"});response.end("Hello World\n");}); // Listen on port 8000, IP defaults to 127.0.0.1server.listen(8000); // Put a friendly message on the terminalconsole.log("Server running at http://127.0.0.1:8000/"); Take a look on the first line of our file, using that line we are just letting know that using current user environment we will run this file with executable. server.js node Saving that file to and making it as an executable ~/hello_world/server.js chmod +x ~/hello_world/server.js It’s time to make SystemD Service Making file , this would be the main file as a configuration to SystemD service /etc/systemd/system/hello_world.service [Unit]Description=Node.js Hello World Http Server [Service]PIDFile=/tmp/hello_world-99.pidUser=<Your Username>Group=<Your User Group>Restart=alwaysKillSignal=SIGQUITWorkingDirectory=/home/<username> ExecStart=/home/<username> /hello_world/ /hello_world/server.js [Install]WantedBy=multi-user.target After saving this file, we can enable this service, to start using it over SystemD sudo systemctl enable hello_world.service That’s it! Now you have Node.js service as a background service, it will be restarted when something goes wrong and you can view all output logs using very simple command sudo journalctl -u hello_world.service # For real time logs just add -f argumentsudo journalctl -fu hello_world.service Conclusion After all this setup kind of things now you got very easy way to manage your service sudo systemctl start hello_world.servicesudo systemctl stop hello_world.servicesudo systemctl restart hello_world.service So you actually don’t need modules like for managing Node.js background services, it all could be done using Linux native tools, which are more performant and more reliable! (hope so). forever So if you learned something from this, just _Recommend This_ for letting to learn others too.