From fa5d54b3df74e7cb43c089091bedb36c51aa6e66 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 30 Oct 2019 22:52:57 -0400 Subject: [PATCH] updated telemetry script to add fifo and remove it --- bin/view-telem | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/view-telem b/bin/view-telem index 2b406a8..8e10c32 100755 --- a/bin/view-telem +++ b/bin/view-telem @@ -1,4 +1,19 @@ #!/bin/sh -while [[ 1 ]]; do - cat ~/tide-telem -done \ No newline at end of file + +FIFO="$HOME/tide-telem" + +quit(){ + rm -f "$FIFO" + exit 0 +} + +# cleanup the fifo when the user says we're done +trap quit INT + +# create the fifo if it doesnt exist +[ ! -e "$FIFO" ] && mkfifo "$FIFO" + +# continually read contents from fifo +while true; do + cat "$FIFO" +done -- 2.52.0