View difference between Paste ID: ZWUjYd0X and 543LiKn4
SHOW: | | - or go back to the newest paste.
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
10+
11-
      systemctl stop kodi
11+
    # stop kodi
12-
      while pidof kodi &>/dev/null; do sleep 1; done
12+
    systemctl stop kodi
13-
    fi
13+
    while pidof kodi.bin &>/dev/null; do sleep 1; done
14-
    if [ -z "$(pidof kodi)" ] && [ -z "$(pidof shell)" ]; then
14+
15-
      # kodi stopped and steamlink not running
15+
    # kodi stopped, launch steamlink
16-
      /storage/steamlink/steamlink.sh
16+
    /storage/steamlink/steamlink.sh &> /storage/logfiles/steamlink.log
17-
      while pidof shell &>/dev/null; do sleep 1; done
17+
    while pidof shell &>/dev/null; do sleep 1; done
18-
    fi
18+
19-
    if [ -z "$(pidof kodi)" ] && [ -z "$(pidof shell)" ]; then
19+
    # steamlink stopped, restart kodi
20-
      # both stopped, restart kodi
20+
    systemctl start kodi
21-
      systemctl start kodi
21+
22-
    fi
22+
23
done