mosquitto_sub -h rpi2 -t stat/sonoff/otaurl -C 2 & mosquitto_pub -h rpi2 -t cmnd/sonoff/otaurl -m '' mosquitto_pub -h rpi2 -t cmnd/sonoff/otaurl -m 'http://'`hostname -s`':8000' file=`ls -t /tmp/*.tmp/sonoff.ino.bin | head` socat -vv TCP-LISTEN:8000,crlf,reuseaddr,fork SYSTEM:"echo HTTP/1.0 200; echo Content-Type\: application/octet-stream; echo Content-Length\: `stat --format %s $file` ; echo ; cat $file"