• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Short script to monitor and restart your MMM-RTSPStreams

Scheduled Pinned Locked Moved General Discussion
2 Posts 2 Posters 472 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    p4lsec
    last edited by Dec 21, 2019, 10:35 PM

    Here is a super short Python script that checks the status of your streams using pm2, then if it detects a stream is down, it restarts the streams. Not elegant, but it works.

    import os
    if "stopped" in os.popen("pm2 status | grep \"stopped\"").read():
        os.popen("pm2 start 1 2 3 4")
    

    I saved it as streamMonitor.py in my home directory. I run it once per minute using crontab. This is the entry I put in:

    * * * * * python3 ~/streamMonitor.py
    

    Here is the script in action:

    0_1576967342114_Screen Shot 2019-12-21 at 5.27.57 PM.png

    And here is the crontab job:

    0_1576967509955_Screen Shot 2019-12-21 at 5.31.45 PM.png s

    1 Reply Last reply Reply Quote 0
    • B Offline
      BKeyport Module Developer
      last edited by Dec 22, 2019, 2:03 AM

      neat. Sadly, OMX had so much trouble getting the streams running, I had to switch to FFMPeg.

      If VLC would boot correctly under node (it won’t), I’d use that, but between syntax errors in the code and node.js not allowing VLC to run correctly, I can’t get it to work.

      The "E" in "Javascript" stands for "Easy"

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      1 / 1
      • First post
        1/2
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy