Say I have a server writing stdout to a consumer
my server | upon 'some pattern' --exit=0
so basically when the consumer reads stdout, and sees a certain pattern it will exit. my question is - when it exits, how I clean up the pipeline and potentially make the server a background process?
Maybe this is just a better way to do it:
( my server &> $file ) &
while true; do
cat $file | upon 'some pattern' --exit=0
done
basically instead of sleep 5 seconds or what not, I am hoping to use a more evented approach, that guarantees the server is ready.