#!/bin/sh # crontab like: * * * * * /home/YOUR_USER_HERE/cwstats CWDAT="/tmp/cloudwatcher.dat" CWFMT="/tmp/cloudwatcher.txt" CWHOST="aagsolo.local" exec 1>"$CWFMT" curl --silent http://${CWHOST}/cgi-bin/cgiLastData >${CWDAT} echo if [ $(awk -F= '/^safe=/ { print $2 }' ${CWDAT}) = "1" ]; then printf 'Safe\n' else printf 'Unsafe: ' if [ $(awk -F= '/^cloudsSafe=/ { print $2 }' ${CWDAT}) != 1 ]; then printf ' Clouds'; fi if [ $(awk -F= '/^windSafe=/ { print $2 }' ${CWDAT}) != 1 ]; then printf ' Wind'; fi if [ $(awk -F= '/^rainSafe=/ { print $2 }' ${CWDAT}) != 1 ]; then printf ' Rain'; fi if [ $(awk -F= '/^lightSafe=/ { print $2 }' ${CWDAT}) != 1 ]; then printf ' Light'; fi if [ $(awk -F= '/^humSafe=/ { print $2 }' ${CWDAT}) != 1 ]; then printf ' Humidity'; fi if [ $(awk -F= '/^pressureSafe=/ { print $2 }' ${CWDAT}) != 1 ]; then printf ' Pressure'; fi printf '\n' fi printf 'Ambient: %.1fC / %.1fF\n' $(awk -F= '/^temp=/ { print $2 }' ${CWDAT}) $(awk -F= '/^temp=/ { print $2 * 9 / 5 + 32 }' ${CWDAT}) printf 'DewPoint: %.1fC / %.1fF\n' $(awk -F= '/^dewp=/ { print $2 }' ${CWDAT}) $(awk -F= '/^dewp=/ { print $2 * 9 / 5 + 32 }' ${CWDAT}) printf 'Humidity: %.0f%%\n' $(awk -F= '/^hum=/ { print $2 }' ${CWDAT}) printf 'Wind: %.1f KPH / %.1f MPH\n' $(awk -F= '/^wind=/ { print $2 }' ${CWDAT}) $(awk -F= '/^wind=/ { print $2 / 1.61 }' ${CWDAT}) printf 'Gusts: %.1f KPH / %.1f MPH\n' $(awk -F= '/^gust=/ { print $2 }' ${CWDAT}) $(awk -F= '/^gust=/ { print $2 / 1.61 }' ${CWDAT}) printf 'Pressure: %.1f / %.1f Pa\n' $(awk -F= '/^abspress=/ { print $2 }' ${CWDAT}) $(awk -F= '/^relpress=/ { print $2 }' ${CWDAT}) printf 'SkyTemp: %.1fC\n' $(awk -F= '/^clouds=/ { print $2 }' ${CWDAT}) printf 'SQM: %.2f MPSAS\n' $(awk -F= '/^lightmpsas=/ { print $2 }' ${CWDAT})