24 lines
663 B
Bash
Executable File
24 lines
663 B
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
## data passed from incron:
|
|
# $1 dir being watched
|
|
# $2 file name created in $1
|
|
|
|
LOG=/home/ddp/log/hassio-incron.log
|
|
WHEN=`date +'%H:%M:%S %d-%m-%y'`
|
|
if [ "$2" = "notify.txt" ]; then
|
|
str=`cat $1/$2`
|
|
tv=`host tv.ddp.net | awk ' { print $4 } '`
|
|
/usr/bin/mythutil --message --message_text "$str" --timeout 3 --bcastaddr=$tv
|
|
echo "$WHEN: Sent message: $str to myth running on tv" >> $LOG
|
|
elif [ "$2" = "netatmo.txt" ]; then
|
|
mode=`cat $1/$2`
|
|
echo "$WHEN: netatmo starting to set to: $mode" >> $LOG
|
|
/home/ddp/bin/sec_light.py $mode
|
|
echo "$WHEN: netatmo finished set to: $mode" >> $LOG
|
|
else
|
|
echo "$WHEN: UNKNOWN ACTION: $2" >> $LOG
|
|
fi
|
|
sudo rm $1/$2
|