Logging for pipelines?
This commit is contained in:
parent
b81bdf6abd
commit
8d1e86feb4
2
bin/fsw
2
bin/fsw
|
@ -82,6 +82,6 @@ inotifywait -m -e "${FSW_EVENTS}" -r "${DIRS[@]}" 2>&1 \
|
||||||
export FSW_EVENT="$events $dir$filename"
|
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 "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")"
|
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
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -33,13 +33,17 @@ if [[ ! -z "${1+x}" ]]; then
|
||||||
out="${1}"; shift
|
out="${1}"; shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: if no logging, log="/dev/null"
|
||||||
|
log="$td/log"
|
||||||
|
|
||||||
chmod +x "$transform"
|
chmod +x "$transform"
|
||||||
echo "Hello World" > "$in"
|
echo "Hello World" > "$in"
|
||||||
|
touch "$log"
|
||||||
|
|
||||||
fswi \
|
fswi \
|
||||||
"bash -c '< \"$in\" \"$transform\" > \"$out\"'" \
|
"bash -c 'cd \"$td\" && < \"$in\" \"$transform\" | tee \"$out\"'" \
|
||||||
'in$|transform$' \
|
'in$|transform$' \
|
||||||
"$td" "$pdir" &> /dev/null &
|
"$td" "$pdir" &> "$log" &
|
||||||
watcher="$!"
|
watcher="$!"
|
||||||
|
|
||||||
if [[ -z ${cleanup_trap+x} ]]; then
|
if [[ -z ${cleanup_trap+x} ]]; then
|
||||||
|
|
Reference in a new issue