ncd-mqtt.service
[eg5120] / mqtt-pgsql.sh
index 2f8c2e8..1d66f99 100755 (executable)
@@ -1,8 +1,10 @@
 #!/bin/sh -e
 
+cd /home/dpavlin/eg5120
+
 mosquitto_sub -h localhost -t eg5120 | while read json ; do
        date=$( date +%Y-%m-%dT%H:%M:%S )
-       echo -n $date ' '
+       #echo -n $date ' '
        echo $json | tee data/$date.json | tee /dev/shm/last-eg5120.json
        psql --quiet -c "copy eg5120 (json) from '/dev/shm/last-eg5120.json'" eg5120
 done