Search code examples
node.jsserverlinux-kernelbackground-process

How do you run programs forever in the background on Linux


In a development environment to run a node.js script you type node app.js. However once you deploy your program on an actual Linux sever if you close the terminal it stops running your script. Is there a command that I can run that keeps that script running in the background even after closing the terminal?


Solution

  • You could definitely use Forever (https://github.com/foreverjs/forever) for this, however some newer linux distributions allow you to config services using systemd which is considered the better practice since it overlaps a bit with Forever in functionality.

    You will easily find more information about it with a quick google search.