Advertisement
Guest User

steamlink_monitor.sh

a guest
Apr 13th, 2019
16,540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # initial boot
  4. cd /storage/steamlink/ || exit 1
  5. [ -f /tmp/launch_steamlink ] && rm -f /tmp/launch_steamlink
  6.  
  7. while true; do
  8.   if [ -f /tmp/launch_steamlink ]; then
  9.     rm -f /tmp/launch_steamlink
  10.     if [ ! -z "$(pidof kodi)" ]; then
  11.       systemctl stop kodi
  12.       while pidof kodi &>/dev/null; do sleep 1; done
  13.     fi
  14.     if [ -z "$(pidof kodi)" ] && [ -z "$(pidof shell)" ]; then
  15.       # kodi stopped and steamlink not running
  16.       /storage/steamlink/steamlink.sh
  17.       while pidof shell &>/dev/null; do sleep 1; done
  18.     fi
  19.     if [ -z "$(pidof kodi)" ] && [ -z "$(pidof shell)" ]; then
  20.       # both stopped, restart kodi
  21.       systemctl start kodi
  22.     fi
  23.   fi
  24.   sleep 1
  25. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement