Page 1 of 1

script for kodi shutdown and start

Posted: Thursday 29 September 2016 19:46
by DaWauZ
Hello,

I have made a little script with a little help from user mcwieger
But I think the shutting down command is giving a little error in the log. Well, the kodi mediaplayer does shutdown.
The mediaplayer is a openelec installation on a thin client, enabled WOL on that device. Installed etherwake on my domoticz pi.

I made a virtual switch, and put this in my domoticz_main:

Code: Select all

#!/bin/sh

startup_path=$1
hardware_id=$2
device_id=$3
status=$4
status2=$5
devname=$6

echo "startup_path=${startup_path}, hardware_id=${hardware_id}, device_id=${device_id}, status=${status}, status2=${status2}, devname=${devname}"

##### START KODI COMMANDS #####
### Native Kodi does not shutdown correctly. Two switches were created to switch Kodi on and off
### Kodi - Power On
if [ "$device_id" = "13" ] ; then
if [ "$status" = "On" ] ; then
sudo etherwake C8:CB:B8:03:54:84
fi
fi
if [ "$device_id" = "13" ] ; then
if [ "$status" = "Off" ] ; then
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"System.Shutdown"}' http://192.168.1.13:80/jsonrpc
fi
fi
#### END KODI COMMANDS #####

In the log its giving this error when shutting down mediaplayer (press off)

Code: Select all

2016-09-29 19:34:33.147 Error: Error executing script command (/home/pi/domoticz/scripts/domoticz_main). returned: 13312
I dont know exactly why.

(I'm sorry I am not a very good in linux)

Re: script for kodi shutdown and start

Posted: Thursday 24 November 2016 14:37
by borgkitty
did you make the script excutable by issuing the "chmod +X *scriptname*" command?