Skip to content

PM2 on IoT

AlDoo edited this page May 1, 2018 · 4 revisions

PM2 on IoT

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

if you followed Raspberry Pi installation guide you already have pm2, otherwise it is advisable to have pm2 installed globally

sudo npm -g pm2

First start the app using pm2start.js script and your password

$ node pm2start --pwd=YOUR_PASSWORD

after the app successfully started (make sure of it by looking at pm2 logs) first save current process list

pm2 save

then, terminate the pm2 process with

pm2 delete streembit

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/

Now, it is time to reboot OS and check if the app was autostarted by PM2 daemon You can use this command to display current pm2 state

pm2 list

replace YOUR_USER_NAME with a a corresponding account name on OS and make sure paths are correct

Clone this wiki locally