From 8d1e86feb4ebccec06233f8ea1f67b75d63cf222 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 12 Dec 2019 13:31:18 -0600 Subject: [PATCH] Logging for pipelines? --- bin/fsw | 2 +- bin/pipeline | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/fsw b/bin/fsw index fd40d37..08331cd 100755 --- a/bin/fsw +++ b/bin/fsw @@ -82,6 +82,6 @@ inotifywait -m -e "${FSW_EVENTS}" -r "${DIRS[@]}" 2>&1 \ export FSW_EVENT="$events $dir$filename" dbg "Event:\n $(date)\n $FSW_PATH\n $FILTER\n $FSW_EVENT\n $dir $events $filename\n ${SHELL_COMMAND}" dbg "Filtered Event: $(<<< "$FSW_PATH" grep -P "$FILTER")" - <<< "$FSW_PATH" grep -P "$FILTER" > /dev/null 2>&1 && eval "${SHELL_COMMAND}" &> /dev/null + <<< "$FSW_PATH" grep -P "$FILTER" > /dev/null 2>&1 && eval "${SHELL_COMMAND}" fi done diff --git a/bin/pipeline b/bin/pipeline index 1d53fd7..fb42f12 100755 --- a/bin/pipeline +++ b/bin/pipeline @@ -33,13 +33,17 @@ if [[ ! -z "${1+x}" ]]; then out="${1}"; shift fi +# TODO: if no logging, log="/dev/null" +log="$td/log" + chmod +x "$transform" echo "Hello World" > "$in" +touch "$log" fswi \ - "bash -c '< \"$in\" \"$transform\" > \"$out\"'" \ + "bash -c 'cd \"$td\" && < \"$in\" \"$transform\" | tee \"$out\"'" \ 'in$|transform$' \ - "$td" "$pdir" &> /dev/null & + "$td" "$pdir" &> "$log" & watcher="$!" if [[ -z ${cleanup_trap+x} ]]; then