Use ncat with meas web for multiple clients
This commit is contained in:
parent
a41ded0246
commit
93e5fa8956
5 changed files with 12 additions and 14 deletions
|
@ -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
|
||||
|
|
3
modules/rhizo_base/files/etc/sv/meas-json/scr
Executable file
3
modules/rhizo_base/files/etc/sv/meas-json/scr
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
exec 2>&1
|
||||
exec /usr/bin/stdbuf -oL /usr/bin/meas_json
|
|
@ -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
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
sv restart meas-json
|
||||
exec cat /tmp/json_pipe
|
|
@ -30,7 +30,7 @@ class rhizo_base::packages::common {
|
|||
'sngrep', 'rrdtool', 'dnsmasq', 'joe', 'curl', 'htop', 'screen', 'iperf3',
|
||||
'websocketd', 'fping', 'mtr-tiny', 'openssh-server', 'telnet', 'netcat-traditional',
|
||||
'python-unidecode', 'python-dateutil', 'python-yaml', 'python-formencode',
|
||||
'python-smpplib', 'python-psycopg2', 'python-pysqlite2' ]:
|
||||
'python-smpplib', 'python-psycopg2', 'python-pysqlite2', 'ncat' ]:
|
||||
ensure => installed,
|
||||
require => Class['rhizo_base::apt'],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue