Logging for pipelines?

This commit is contained in:
Daniel Flanagan 2019-12-12 13:31:18 -06:00
parent b81bdf6abd
commit 8d1e86feb4
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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