Read the statement by Michael Teeuw here.
Problems with starting pm2 start mm.sh
-
I am having the same problem: I did what was mentioned above and after the reboot it stll did not start automaticly. Running “pm2 list” after the reboot shows mm.sh is not runnning.
permitted by applicable law. Last login: Sun Jul 28 20:48:49 2019 pi@magicmirror:~ $ pm2 list [PM2] Spawning PM2 daemon with pm2_home=/home/pi/.pm2 [PM2] PM2 Successfully daemonized ┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ └──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app pi@magicmirror:~ $ pm2 start installers/mm.sh [PM2][ERROR] script not found : /home/pi/installers/mm.sh script not found : /home/pi/installers/mm.sh ┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ └──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app pi@magicmirror:~ $ pm2 start mm.sh [PM2] Starting /home/pi/mm.sh in fork_mode (1 instance) [PM2] Done. ┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬──────────┬──────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼─────────┼──────┼─────┼────────┼─────────┼────────┼─────┼──────────┼──────┼──────────┤ │ mm │ 0 │ N/A │ fork │ 718 │ online │ 0 │ 0s │ 0% │ 2.6 MB │ pi │ disabled │ └──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴──────────┴──────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app pi@magicmirror:~ $ pm2 save [PM2] Saving current process list... [PM2] Successfully saved in /home/pi/.pm2/dump.pm2 pi@magicmirror:~ $ pm2 list ┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬──────────┬──────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼─────────┼──────┼─────┼────────┼─────────┼────────┼─────┼──────────┼──────┼──────────┤ │ mm │ 0 │ N/A │ fork │ 718 │ online │ 0 │ 44s │ 0% │ 2.6 MB │ pi │ disabled │ └──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴──────────┴──────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app pi@magicmirror:~ $ pm2 save [PM2] Saving current process list... [PM2] Successfully saved in /home/pi/.pm2/dump.pm2 pi@magicmirror:~ $ sudo reboot Connection to 192.168.138.28 closed by remote host. Connection to 192.168.138.28 closed.
pi@magicmirror:~ $ cat mm.sh cd /home/pi/MagicMirror DISPLAY=:0 npm start pi@magicmirror:~ $ ls -lha mm.sh -rwxr-xr-x 1 pi pi 45 Jul 28 20:14 mm.sh pi@magicmirror:~ $
-
@Raksasas should be executing those while in the MagicMirror folder
-
Looking over the “Auto Start” page I do not see where it states that the pm2 commands are to be run while inside the MagicMirror folder.
With you stating that it seems to be saying that the “mm.sh” script needs to be ran from inside the “MagicMirror” too. Again the “Auto Start” page shows that it was created inside the ‘home’ (~) folder. So one would think/presume it can be ran from inside the “home” folder also.
Either way I will give it a go.
-
-
@Raksasas it was the
pm2 start installers/mm.sh
That needed to be done from the MagicMirror folder.
Cause I ‘ASSUMED’ if u were working on mm, you would always be in that folder.
installers folder is in mm, not in user home
-
Part 1:
@sdetweilJust tried the
pm2 start installers/mm.sh pm2 save
From within the “MagicMirror” folder and no change. MagicMirror starts and at reboot it does not automaticly start
See below for my fix
Part 2:
@mumblebaj
This seems possible. So i re-ransudo npm install -g pm2 pm2 startup
After running “pm2 startup” this time I noticed the following:
To setup the Startup Script, copy/paste the following command: sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
So I ran that and followed with the “pm2 start mm.sh” and “pm2 save”. Well now it is auto starting on reboot.
-
@Raksasas great news!
-
@Raksasas Exellent. Great it is working now.
-