There’s a REALLY simple way to do this using a script and a cron job.
From the pi user, execute:
sudo nano /bin/mmreload.sh
Paste the following contents into that file:
#!/bin/sh
if [ /home/pi/MagicMirror/config/config.js -nt /home/pi/.pm2/pids/mm-0.pid ]; then
/usr/bin/pm2 restart mm
fi
Save it (CTRL-X) and then give it execute permissions like this:
sudo chmod +x /bin/mmreload.sh
From the pi user, execute the following:
crontab -e
In the crontab file, add the following line:
0,30 * * * * /bin/mmreload.sh > /dev/null 2>&1
Save the file (CTRL-X if you’re using nano).
This will check the MM ‘pid’ file against the config.js file to see if the configuration file has been edited since the mirror was last started (it will check at the top and bottom of every hour). If the config file has been edited, it will restart MM and use the new configuration file.