@Damian Sure, I can do that. Let me re-write this a bit.
Step 1 - Create a script called sonos.sh
in the home directory (~
).
cd ~
nano sonos.sh
Enter the following in the nano editor for the contents of your sonos.sh
script:
cd ~/node-sonos-http-api
DISPLAY=:0 npm start
Save the file and exit the nano editor.
Step 2 - Make your script executable by entering chmod +x sonos.sh
Step 3 - Tell pm2 to manage your sonos script so that it is always running in the background:
pm2 start sonos.sh
pm2 save
Verify that pm2 is managing both your sonos.sh
script and the mm.sh
script by typing pm2 status all
. You should see two lines, one for each script.
Step 4 - Clear the logs and bounce your mirror and verify that everything works as planned.
pm2 flush
pm2 restart all