Page 1 of 1

Stop/start Kodi by status TV

Posted: Thu Jun 07, 2018 9:14 am
by Malah
Hi
I want to maintance the Kodi by TV status.

Script for example:

Code: Select all

#!/bin/bash

oldcmd=""
while :
do
        cmd=$(/opt/vc/bin/tvservice -n)
        if [[ "$cmd" == *"GSM-LG_TV"* && "$cmd" != "$oldcmd" ]]
        then
                echo starting xbmc
                $(sudo systemctl start mediacenter)
                oldcmd=$cmd
        elif [[ "$cmd" != "$oldcmd" ]] ; then


                echo stopping xbmc
                $(sudo systemctl stop mediacenter)
                oldcmd=$cmd
        fi


        echo $cmd
        sleep 10
done
But it isnt "mediacenter" why?