There are various ways to do this, but if you're doing things directly from the command line, you can use a process manager like pm2.
I'd particularly recommend PM2, as it's really easy to get set up, and pretty full featured. We use it internally to handle all of our production authoring tool installs.