PM2 Setup
Here's my preferred way to run a script like a service. First, to install PM2 on a Debian-based system, here's what I would run as root:
apt install nodejs
apt install npm
npm install -g n
n latest
npm install -g pm2
pm2 startup
Then, in what ever directory contains the software project that needs a "run this forever" treatment, I simply run:
pm2 start script.sh --name script -- argument1 argument2
pm2 save
That will start script.sh with the name "script" and start it with all the command line arguments that come after the last two hyphens.