Commit 313c4f08 authored by Stefano Rivera's avatar Stefano Rivera

Merge branch 'loop-when-start-all' into 'master'

Loop when start all

See merge request !38
parents 080e5da8 267ee337
Pipeline #34522 passed with stages
in 2 minutes and 38 seconds
echo "Available scripts:"
ls /usr/local/bin/
ls /usr/local/sbin/ | sed 's/^/sudo /'
......@@ -25,6 +25,7 @@
- showcpu.sh
- showrelease.sh
- uptime.sh
- showscripts.sh
- name: install motd system stats dependencies
apt:
......
#!/usr/bin/env python3
# Make sure voctocore has been set to loop
# Credits to voctomix example scripts
import socket
import sys
host = 'localhost'
port = 9999
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
try:
sock.connect((host, port))
sock.settimeout(2)
except ConnectionRefusedError:
sys.exit('Voctocore is not running. Exiting')
fd = sock.makefile('rw', buffering=1)
fd.write('set_stream_blank loop\n')
try:
for line in fd:
words = line.rstrip('\n').split(' ')
signal = words[0]
args = words[1:]
if (signal == 'stream_status' and args[0] == 'blank'
and args[1] == 'loop'):
print('Voctomix set to loop')
sys.exit()
except socket.timeout as err:
sys.exit('There was a problem while asking voctocore to display '
'the loop. Please retry or put Voctomix on loop manually')
......@@ -8,6 +8,12 @@
- stop
- start
- name: Script to verify that command to put voctocore into loop has worked
copy:
src: files/voctocore-set-loop
dest: /usr/local/bin/voctocore-set-loop
mode: 0755
- name: Script to show streams
template:
src: templates/videoteam-show-streams.j2
......
......@@ -22,3 +22,8 @@ systemctl --user list-unit-files --state=enabled \
echo systemctl --user {{ item }} $service
systemctl --user {{ item }} $service || true
done
{% if item == 'start' %}
voctocore-set-loop
{% endif %}
......@@ -5,8 +5,9 @@
# Test if the motd is set correctly
diff /etc/motd tests/motd/good_motd.txt && exit || echo "motd not set correctly" && exit 1
# Test if the 3 scripts we use for the motd fail
# Test if the 4 scripts we use for the motd fail
p="/etc/profile.d"
sh $p/showcpu.sh >/dev/null && exit || echo "error in script $p/showcpu.sh" && exit 1
sh $p/showrelease.sh >/dev/null && exit || echo "error in script $p/showrelease.sh" && exit 1
sh $p/uptime.sh >/dev/null && exit || echo "error in script $p/uptime.sh" && exit 1
sh $p/showscripts.sh >/dev/null && exit || echo "error in script $p/showscripts.sh" && exit 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment