winlin

update htbt script

1 #/bin/bash 1 #/bin/bash
2 -ip=`ifconfig 2>&1|grep "inet addr"|grep -v "127"|awk '{print $2}'|awk -F ':' '{print $2}'`  
3 for ((;;)); do 2 for ((;;)); do
4 - echo "heatbeat at `date`" 3 + ip=`ifconfig 2>&1|grep "inet addr"|grep -v "127"|awk '{print $2}'|awk -F ':' '{print $2}'`
  4 + echo "heatbeat at `date`, ip is ${ip}"
5 curl 'http://ossrs.net:8085/api/v1/servers' -H 'Content-Type: text/html' --data-binary "{\"ip\":\"${ip}\",\"device_id\":\"respberry-pi2\"}" && echo "" 5 curl 'http://ossrs.net:8085/api/v1/servers' -H 'Content-Type: text/html' --data-binary "{\"ip\":\"${ip}\",\"device_id\":\"respberry-pi2\"}" && echo ""
6 sleep 10 6 sleep 10
7 done 7 done