[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
#13
Can I run this infinite loop script in you add-on?

It tail the kern.log and do a library update when a HDD gets mounted so I must run all the time because I plug/unplug my HDD a lot of times

/home/pi/sync.sh
Code:
#!/bin/bash
clear
echo "Tailing kern.log: searching for new HDD"
tail -fn0 /tmp/kern.log | while read line ; do
        echo "$line" | grep "kernel: sda: sda1"
        if [ $? = 0 ]
        then
                # Actions
                sleep 3
                curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://localhost/jsonrpc
        fi
done
Reply


Messages In This Thread
Great! - by gnorf - 2013-02-27, 22:50
RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - by fernandovg - 2013-03-28, 16:21
[RELEASE] Pilulli Revisited - by KenV99 - 2014-06-28, 18:18
Logout Mark Read Team Forum Stats Members Help
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)4