#!/bin/bash while :; do python wol_listen.py magicPacket=$? if [ "$magicPacket" -eq 1 ] ; then systemctl is-active kodi > /dev/null isRunning=$? # isrunning is 0, when kodi is running if [ "$isRunning" -ne 0 ] ; then echo 'TV & Kodi on' echo 'on 0' | cec-client -s systemctl start kodi fi fi sleep 10 done exit 0