Wrapper script for sending OTA updates to your ESP8266/NodeMCU.
#!/bin/bash | |
# Wrapper script for sending OTA updates to your ESP8266 running NodeMCU. | |
# See https://judepereira.com/blog/sending-ota-updates-over-wifi-to-your-esp8266/ | |
HOST=192.168.178.25 | |
PORT=8080 | |
for i in "$@"; do | |
FILE=$i | |
echo "Sending $i..." | |
echo -n "BEGIN $FILE" | nc $HOST $PORT | |
while read -r line; do | |
#echo -n "write: $line ... " | |
if ! echo "$line" | nc $HOST $PORT | grep "ok" &>/dev/null; then | |
echo "Write failed! Please retry..." | |
exit 1 | |
fi | |
done <"$FILE" | |
echo -n "DONE" | nc $HOST $PORT | |
done | |
echo -n "RESTART" | nc $HOST $PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment