Read the statement by Michael Teeuw here.
How to autorun script on MagicMirror boot
-
Hi all,
I am having trouble getting my script for the PIR sensor to start on boot.
I followed this guide which used to work until I did a fresh install with the latest version of MagicMirror.
The guide suggests adding the following line to the autostart file in:
~/.config/lxsession/LXDE-pi
@sudo /usr/bin/python /home/pi/MagicMirror/pir.py
… however, I do not have the lxsession directory in ~/.config.
I do have an autostart file in /etc/xdg/, but in the comments for the link I posted above it mentions that this is a global autostart file and the user one is preferred. The OP suggests manually creating the directory and autostart file using the path above, but that doesn’t seem to work either.A few things:
-
my test script shows both 0 and 1 values for the sensor, confirming that it is sensing motion properly.
-
Running my monitor_off.sh / monitor_on.sh scripts manually work as expected
-
Starting my pir.py script manually works as expected
So, this leads me to believe that the problem is with the directory the autostart file is in.
Any help on this is appreciated. Thanks!
-
-
-
I use PM2 and scripts to call the various external modules…
EG: buttons.sh, mm.sh and omx.sh
buttons.sh is a short script to launch python3 for buttons.py, my external button runner.
mm.sh is the startup per the old instructions found in the old docks.
omx.sh launches OMXplayer with a bunch of options.I wouldn’t use two of 'em, if I could get pm2 to launch with command line options.
-
@sdetweil said in How to autorun script on MagicMirror boot:
@byte_me use pm2
pm2 start xxx.py
pm2 save@BKeyport said in How to autorun script on MagicMirror boot:
I use PM2 and scripts to call the various external modules…
EG: buttons.sh, mm.sh and omx.sh
buttons.sh is a short script to launch python3 for buttons.py, my external button runner.
mm.sh is the startup per the old instructions found in the old docks.
omx.sh launches OMXplayer with a bunch of options.I wouldn’t use two of 'em, if I could get pm2 to launch with command line options.
Thank you both, this seems to have solved the issue!
-
-
-
@sdetweil
vncserver 3.6% ,squeezelite 13.9% and Xorg 4.5% -
@kelly97129 Sure. PM2 is simply the best way I’ve found to manage what’s running automatically on my system.