make upgrade - stop systemd, upload, start it again
[GroveSensor] / influx.sh
1 #!/bin/sh
2
3 serial=/dev/serial/by-path/platform-xhci-hcd.3.auto-usb-0:2:1.0-port0
4
5 stty -F $serial ispeed 115200 cs8 -cstopb -parenb -echo igncr
6
7 cat $serial | while read line ; do
8         curl --silent -XPOST "http://10.60.0.92:8086/write?consistency=any&db=rot13" --data-binary "grove,dc=trnjanska,host=$(hostname -s) $line"
9         light=$( echo $line | sed -e 's/^.*,light=//' -e 's/,.*$//' )
10         mosquitto_pub -h rpi2 -t grove/light -m $light
11         echo $line > /dev/shm/grove
12 done