From: Michael D. Lowis Date: Thu, 31 Oct 2019 02:52:57 +0000 (-0400) Subject: updated telemetry script to add fifo and remove it X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=fa5d54b3df74e7cb43c089091bedb36c51aa6e66;p=projs%2Ftide.git updated telemetry script to add fifo and remove it --- 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