]> git.mdlowis.com Git - projs/tide.git/commitdiff
updated telemetry script to add fifo and remove it
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 31 Oct 2019 02:52:57 +0000 (22:52 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 31 Oct 2019 02:52:57 +0000 (22:52 -0400)
bin/view-telem

index 2b406a8da8194e797312375e03476db61876f94f..8e10c326b77fd6be073a6d7433150448fa0f8763 100755 (executable)
@@ -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