Skip to content

PM2 on IoT

AlDoo edited this page Apr 6, 2018 · 4 revisions

PM2 on IoT

The purpose of these instructions is to make the app automatically start on system boot up. To acheive this we will rely on [PM2]: https://www.npmjs.com/package/pm2

First start the app with pm2start.js file and your password

$ node pm2start --pwd=YOUR_PASSWORD

a quick side note: since pm2 was not installed globally but rather as a node dependency the path executable would be ./node_modules/pm2/bin/pm2

after the app successfully executed (make sure of it by looking at pm2 logs) first stop it by using

./node_module/pm2/bin/pm2 delete all

then do

sudo env PATH=$PATH:/home/YOUR_USER_NAME/PATH_TO_CLI/streembit-cli/node_modules/pm2/bin pm2 startup -u YOUR_USER_NAME --hp /home/YOUR_USER_NAME/

next, execute

/home/uiot/streembit-cli/node_modules/pm2/bin pm2 save

replace YOUR_USER_NAME with a username of your choice and check for the correctness of the path

Now, it is time to reboot OS and check if the app was autostarted by PM2 daemon you can do it with

/home/uiot/streembit-cli/node_modules/pm2/bin pm2 list

Clone this wiki locally