Skip to content

Autostart Muttlee

Peter Kwan edited this page Aug 25, 2018 · 6 revisions

Autostarting Muttlee

(Reference: Start node on a Pi)

pm2 is a system that can keep a process running. It needs npm to install the node package manager if you haven't already.

sudo apt-get install npm
sudo npm install -g pm2

##Register pm2 so that it starts automatically

sudo env PATH=$PATH:/usr/local/bin/
pm2 startup linux -u pi
pm2 save

Make the pm2 user pi instead of root

Edit /etc/init.d/pm2 and change HOME from root to pi

##To start the teletext server cd to the folder that contains teletextserver.js and type

pm2 start teletextserver.js 

Do we need to do pm2 save at this point? Not sure. Obviously you'll want to stop and start this during development. To stop the server and run in the console:

pm2 stop teletextserver.js
node teletextserver.js

Logs and drive space

The PM2 logs are in ~/.pm2/logs and console.log is sent here. A production version should only send a few error messages here. A bug can fill the drive with logs very fast. Watch this to ensure that it doesn't clog up your system. To show your disk space type:

sudo du -sh /home/pi/*

Clone this wiki locally