Stop Magic Mirror interface and Shutdown R Pi automatically at given timepoints



  • Hi all,

    first, I m new to this and I am a total noob in programming and setting up stuff.
    Anyway, somehow I managed to build my own MM with the help of tutorials and guides from this site :)

    I m planning to shutdown my R Pi at different timepoints, for example every evening at 11 pm.
    I googled and I found out that I can do this using cronjob.

    To date, I manually stop my MM interface using the “pm2 stop mm” command in the console. This brings me back to the desktop. Then I shut down my R Pi using either the shutdown button in the R Pi Menu or by the shutdown command in the console.

    I m planning now to use a cronjob to shut down my R pi. Here s my problem:

    Do I have to stop my MM interface (using the “pm2 stop mm” command in the console) before I shut down my R pi with the cronjob? Will there be any errors occuring after next boot if the R pi just shuts down at 11 pm without stopping the Magic Mirror surface in advance?

    Or can I add to the cronjob that MM interface should stop, before executing the shutdown?
    I don´t know how to handle/set up this.

    Can you help please?

    Thanks and Best regards
    Lukas



  • Hi all,

    after some more reading I constructed the following:

    sudo crontab -e

    Adding:
    55 7 * * 0-4 /pm2 stop mm
    (at 07:55 am quit Magicmirror , sundays - thursdays)
    0 8 * * 0-4 /sudo shutdown -h
    (at 08:00 am shutdown R Pi , sundays - thursdays)

    After shutdown: Power off with timeclock

    Can anyone verify that this will work?

    Thank you very much

    Greetings
    Lukas


  • Module Developer

    @vortex No need to stop MM if you are doing a full shutdown. Whether you have MM managed by PM2 or are starting MM manually with npm start, the processes will be killed as part of the shutdown process.

    I’ve restarted or shut down my Mirror many times without stopping MM, and I have not run into any issues.



  • Hi Jeff

    thanks for your reply and help!
    Now I will skip the stopping process and directly go for shutdown.

    Greetings
    Lukas


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.