#!/bin/sh
update_fb() {
source_url="https://www.facebook.com/cutespring"
url="http://api.facebook.com/restserver.p...ls=$source_url"
num="`wget -O - $url 2>/dev/null | grep total | sed -e 's/^[ ]*<total_count>\([0-9][0-9]*\).*/\1/g'`"
xnum=$((0 + num))
if [ "$xnum" -gt 0 ]; then
echo "updating $xnum"
echo "$xnum." >/dev/ttyACM0
ret=$?
fi
}
check_network_connectivity () {
run=1
while [ $run -eq 1 ]; do
ping -c 1 168.95.1.1
run=$?
done
}
# main
check_network_connectivity
while [ 1 ] ; do
update_fb
sleep 5
done