Use ncat with meas web for multiple clients

This commit is contained in:
Keith Whyte 2021-02-24 04:59:18 +01:00
parent a41ded0246
commit 93e5fa8956
5 changed files with 12 additions and 14 deletions

View file

@ -1,4 +1,10 @@
#!/bin/bash
exec 2>&1
exec /usr/bin/stdbuf -oL /usr/bin/meas_json > /tmp/json_pipe
if [ -a /tmp/json_socket ]; then
killall ncat
killall meas_json
rm -f /tmp/json_socket
fi
exec /etc/sv/meas-json/scr | ncat -l -U /tmp/json_socket -k --send-only

View file

@ -0,0 +1,3 @@
#!/bin/sh
exec 2>&1
exec /usr/bin/stdbuf -oL /usr/bin/meas_json

View file

@ -1,11 +1,3 @@
#!/bin/bash
exec 2>&1
if [ ! -p /tmp/json_pipe ] ; then
if [ -f /tmp/json_pipe ] ; then
rm -f /tmp/json_pipe
fi
mkfifo /tmp/json_pipe
fi
exec /usr/bin/websocketd --staticdir=/var/www/meas --port=8080 /etc/sv/meas-web/scr
exec /usr/bin/websocketd --staticdir=/var/www/meas --port=8080 ncat -U /tmp/json_socket

View file

@ -1,3 +0,0 @@
#!/bin/sh
sv restart meas-json
exec cat /tmp/json_pipe