<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to autorun script on MagicMirror boot]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">I am having trouble getting my script for the PIR sensor to start on boot.</p>
<p dir="auto">I followed <a href="https://www.putorius.net/using-pir-sensor-for-motion-detection.html" target="_blank" rel="noopener noreferrer nofollow ugc">this guide</a> which used to work until I did a fresh install with the latest version of MagicMirror.</p>
<p dir="auto">The guide suggests adding the following line to the autostart file in:</p>
<pre><code>~/.config/lxsession/LXDE-pi
</code></pre>
<pre><code>@sudo /usr/bin/python /home/pi/MagicMirror/pir.py
</code></pre>
<p dir="auto">… however, I do not have the lxsession directory in ~/.config.<br />
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.</p>
<p dir="auto">A few things:</p>
<ul>
<li>
<p dir="auto">my test script shows both 0 and 1 values for the sensor, confirming that it is sensing motion properly.</p>
</li>
<li>
<p dir="auto">Running my monitor_off.sh / monitor_on.sh scripts manually work as expected</p>
</li>
<li>
<p dir="auto">Starting my <a href="http://pir.py" target="_blank" rel="noopener noreferrer nofollow ugc">pir.py</a> script manually works as expected</p>
</li>
</ul>
<p dir="auto">So, this leads me to believe that the problem is with the directory the autostart file is in.</p>
<p dir="auto">Any help on this is appreciated. Thanks!</p>
]]></description><link>https://forum.magicmirror.builders/topic/12303/how-to-autorun-script-on-magicmirror-boot</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 11:39:55 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/12303.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 07 Mar 2020 19:19:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Fri, 08 May 2020 16:53:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kelly97129" aria-label="Profile: kelly97129">@<bdi>kelly97129</bdi></a> Sure. PM2 is simply the best way I’ve found to manage what’s running automatically on my system.</p>
]]></description><link>https://forum.magicmirror.builders/post/74874</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/74874</guid><dc:creator><![CDATA[BKeyport]]></dc:creator><pubDate>Fri, 08 May 2020 16:53:22 GMT</pubDate></item><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Fri, 08 May 2020 15:01:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
vncserver 3.6% ,squeezelite 13.9% and Xorg 4.5%</p>
]]></description><link>https://forum.magicmirror.builders/post/74867</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/74867</guid><dc:creator><![CDATA[kelly97129]]></dc:creator><pubDate>Fri, 08 May 2020 15:01:57 GMT</pubDate></item><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Fri, 08 May 2020 14:53:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kelly97129" aria-label="Profile: kelly97129">@<bdi>kelly97129</bdi></a> if you run the</p>
<pre><code> top 
</code></pre>
<p dir="auto">command, what process is most active?</p>
]]></description><link>https://forum.magicmirror.builders/post/74866</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/74866</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Fri, 08 May 2020 14:53:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Fri, 08 May 2020 14:27:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bkeyport" aria-label="Profile: BKeyport">@<bdi>BKeyport</bdi></a><br />
Hello<br />
Can you tell me or show me what your <a href="http://omx.sh" target="_blank" rel="noopener noreferrer nofollow ugc">omx.sh</a> and other scripts look like that you are running on pm2 because I am in raspi4 and buster updated and my MM is running hard and I don’t know why<br />
thank you in advance</p>
]]></description><link>https://forum.magicmirror.builders/post/74865</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/74865</guid><dc:creator><![CDATA[kelly97129]]></dc:creator><pubDate>Fri, 08 May 2020 14:27:42 GMT</pubDate></item><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Sun, 08 Mar 2020 02:43:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> said in <a href="/post/70320">How to autorun script on MagicMirror boot</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/byte_me" aria-label="Profile: byte_me">@<bdi>byte_me</bdi></a> use pm2</p>
<p dir="auto">pm2 start <a href="http://xxx.py" target="_blank" rel="noopener noreferrer nofollow ugc">xxx.py</a><br />
pm2 save</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bkeyport" aria-label="Profile: BKeyport">@<bdi>BKeyport</bdi></a> said in <a href="/post/70325">How to autorun script on MagicMirror boot</a>:</p>
<blockquote>
<p dir="auto">I use PM2 and scripts to call the various external modules…</p>
<p dir="auto">EG: <a href="http://buttons.sh" target="_blank" rel="noopener noreferrer nofollow ugc">buttons.sh</a>, <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a> and <a href="http://omx.sh" target="_blank" rel="noopener noreferrer nofollow ugc">omx.sh</a></p>
<p dir="auto"><a href="http://buttons.sh" target="_blank" rel="noopener noreferrer nofollow ugc">buttons.sh</a> is a short script to launch python3 for <a href="http://buttons.py" target="_blank" rel="noopener noreferrer nofollow ugc">buttons.py</a>, my external button runner.<br />
<a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a> is the startup per the old instructions found in the old docks.<br />
<a href="http://omx.sh" target="_blank" rel="noopener noreferrer nofollow ugc">omx.sh</a> launches OMXplayer with a bunch of options.</p>
<p dir="auto">I wouldn’t use two of 'em, if I could get pm2 to launch with command line options.</p>
</blockquote>
<p dir="auto">Thank you both, this seems to have solved the issue!</p>
]]></description><link>https://forum.magicmirror.builders/post/70326</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/70326</guid><dc:creator><![CDATA[byte_me]]></dc:creator><pubDate>Sun, 08 Mar 2020 02:43:30 GMT</pubDate></item><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Sun, 08 Mar 2020 00:36:05 GMT]]></title><description><![CDATA[<p dir="auto">I use PM2 and scripts to call the various external modules…</p>
<p dir="auto">EG: <a href="http://buttons.sh" target="_blank" rel="noopener noreferrer nofollow ugc">buttons.sh</a>, <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a> and <a href="http://omx.sh" target="_blank" rel="noopener noreferrer nofollow ugc">omx.sh</a></p>
<p dir="auto"><a href="http://buttons.sh" target="_blank" rel="noopener noreferrer nofollow ugc">buttons.sh</a> is a short script to launch python3 for <a href="http://buttons.py" target="_blank" rel="noopener noreferrer nofollow ugc">buttons.py</a>, my external button runner.<br />
<a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a> is the startup per the old instructions found in the old docks.<br />
<a href="http://omx.sh" target="_blank" rel="noopener noreferrer nofollow ugc">omx.sh</a> launches OMXplayer with a bunch of options.</p>
<p dir="auto">I wouldn’t use two of 'em, if I could get pm2 to launch with command line options.</p>
]]></description><link>https://forum.magicmirror.builders/post/70325</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/70325</guid><dc:creator><![CDATA[BKeyport]]></dc:creator><pubDate>Sun, 08 Mar 2020 00:36:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to autorun script on MagicMirror boot on Sat, 07 Mar 2020 22:49:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/byte_me" aria-label="Profile: byte_me">@<bdi>byte_me</bdi></a> use pm2</p>
<p dir="auto">pm2 start <a href="http://xxx.py" target="_blank" rel="noopener noreferrer nofollow ugc">xxx.py</a><br />
pm2 save</p>
]]></description><link>https://forum.magicmirror.builders/post/70320</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/70320</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 07 Mar 2020 22:49:11 GMT</pubDate></item></channel></rss>