Meas: separate the meas_json task

This allows more than one client to open the web meas
This commit is contained in:
Monocots 2020-04-10 20:07:36 +00:00 committed by Keith Whyte
parent dc28f03a7c
commit bca9ccae5d
4 changed files with 21 additions and 2 deletions

View file

@ -0,0 +1,4 @@
#!/bin/sh
LOG_FOLDER=/var/log/meas-json
mkdir -p $LOG_FOLDER
exec svlogd -tt $LOG_FOLDER

View file

@ -0,0 +1,4 @@
#!/bin/bash
exec 2>&1
exec /usr/bin/stdbuf -oL /usr/bin/meas_json > /tmp/json_pipe

View file

@ -1,3 +1,8 @@
#!/bin/sh #!/bin/bash
exec 2>&1 exec 2>&1
exec /usr/bin/websocketd --staticdir=/var/www/meas --port=8080 /usr/bin/stdbuf -oL /usr/bin/meas_json
if [ ! -p /tmp/json_pipe ] ; then
mkfifo /tmp/json_pipe
fi
exec /usr/bin/websocketd --staticdir=/var/www/meas --port=8080 cat /tmp/json_pipe

View file

@ -77,4 +77,10 @@ class rhizo_base::runit {
require => [ File['/etc/sv'], Package['websocketd'] ], require => [ File['/etc/sv'], Package['websocketd'] ],
} }
file { '/etc/service/meas-json':
ensure => link,
target => '/etc/sv/meas-json',
require => [ File['/etc/sv'] ],
}
} }