2013-03-28, 16:21
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
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