X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=bin%2Fkhatus_loop;h=49524837f339e48cc5214f665697d34051eb1cdb;hb=6339a4f8d02b2fadd27bdbf54c7f29f809327027;hp=3603e251649f12f430ccda8ac4e00ddef826f75d;hpb=f1da640c0827541ab1f72cfaeff9e2d6f29c1ce9;p=khatus.git diff --git a/bin/khatus_loop b/bin/khatus_loop index 3603e25..4952483 100755 --- a/bin/khatus_loop +++ b/bin/khatus_loop @@ -2,7 +2,7 @@ MSG_TAG_SEP=': ' -fetch_weather() { +produce_weather() { metar -d "$WEATHER_STATION_ID" 2>&1 \ | awk ' /METAR pattern not found in NOAA data/ { @@ -23,11 +23,11 @@ fetch_weather() { }' } -fetch_datetime() { +produce_datetime() { date +'%a %b %d %H:%M:%S' } -read_and_react() { +consume() { pipe="$1" tail -f "$pipe" \ | stdbuf -o L awk \ @@ -66,7 +66,7 @@ read_and_react() { ' } -trigger_bar() { +produce_bar_req() { echo '' } @@ -91,10 +91,10 @@ main() { rm -f "$pipe" mkfifo "$pipe" - spawn fetch_datetime "$pipe" 'in:DATE_TIME' 1 - spawn fetch_weather "$pipe" 'in:WEATHER' $(( 30 * 60 )) - spawn trigger_bar "$pipe" 'out:BAR' 1 - read_and_react "$pipe" + spawn produce_datetime "$pipe" 'in:DATE_TIME' 1 + spawn produce_weather "$pipe" 'in:WEATHER' $(( 30 * 60 )) + spawn produce_bar_req "$pipe" 'out:BAR' 1 + consume "$pipe" } main $@