From: Siraaj Khandkar Date: Sun, 29 Jul 2018 21:45:01 +0000 (-0400) Subject: Construct cmd string before passing to spawn X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=commitdiff_plain;h=0c0ebbe10445b54e0b6be3590f926755d9658aac Construct cmd string before passing to spawn (to de-clutter the spawning section) --- diff --git a/bin/khatus_loop b/bin/khatus_loop index af5b6ab..dd45962 100755 --- a/bin/khatus_loop +++ b/bin/khatus_loop @@ -293,27 +293,30 @@ main() { esac done + pipe="$dir_data/khatus_data_pipe" + ( echo "Khatus starting with the following parameters:" ( echo " dir_data|= $dir_data" + echo " pipe|= $pipe" echo " weather_station_id|= $weather_station_id" ) | column -ts\| echo '' ) >&2 - pipe="$dir_data/khatus_data_pipe" - mkdir -p "$dir_data" rm -f "$pipe" mkfifo "$pipe" + cmd_produce_weather="produce_weather $weather_station_id" + # TODO: Redirect each worker's stderr to a dedicated log file - spawn produce_datetime "$pipe" 'in:DATE_TIME' 1 - spawn "produce_weather $weather_station_id" "$pipe" 'in:WEATHER' $(( 30 * 60 )) - spawn produce_mpd_state "$pipe" 'in:MPD_STATE' 1 - spawn produce_mpd_song "$pipe" 'in:MPD_SONG' 1 - spawn produce_volume "$pipe" 'in:VOLUME' 1 - spawn produce_bar_req "$pipe" 'out:BAR' 1 - consume "$pipe" + spawn produce_datetime "$pipe" 'in:DATE_TIME' 1 + spawn "$cmd_produce_weather" "$pipe" 'in:WEATHER' $(( 30 * 60 )) + spawn produce_mpd_state "$pipe" 'in:MPD_STATE' 1 + spawn produce_mpd_song "$pipe" 'in:MPD_SONG' 1 + spawn produce_volume "$pipe" 'in:VOLUME' 1 + spawn produce_bar_req "$pipe" 'out:BAR' 1 + consume "$pipe" } main $@