Browse Source

versione iniziale

boyska 11 months ago
commit
a63865a108
3 changed files with 45 additions and 0 deletions
  1. 4 0
      README.md
  2. 29 0
      abbozzino/usr/local/sbin/abbozzino
  3. 12 0
      imbruttino/usr/local/bin/imbruttino

+ 4 - 0
README.md

@@ -0,0 +1,4 @@
+
+L'imbruttino è lo streaming alpha, comanda esso, fa brutto all'abbozzino.
+
+Il quale abbozzino, per l'appunto, abbozza, e trova il coraggio di streammare solo quando l'imbruttino muore.

+ 29 - 0
abbozzino/usr/local/sbin/abbozzino

@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -eu
+
+checkFile=/home/rorserver/inibisci-streaming
+# in minutes
+waitingTime=3
+service=liquidsoap@main.service
+
+uptime="$(cut -d. -f1 < /proc/uptime)"
+sleepTime="$((waitingTime * 60 - uptime))"
+if [[ "$sleepTime" -gt 0 ]]; then
+	sleep "$sleepTime"
+fi
+
+
+while true
+do
+	if [ -n "$(find "${checkFile}" -type f -mmin "-${waitingTime}" 2> /dev/null)" ]
+	then
+		echo "stop"
+		systemctl stop --no-block "${service}" || true
+	else
+		echo "start"
+		systemctl start --no-block "${service}" || true
+	fi
+
+	sleep 1m
+done

+ 12 - 0
imbruttino/usr/local/bin/imbruttino

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -eu
+
+while true
+do
+	if ! ssh ciocchino.hidden  touch inibisci-streaming
+	then
+		echo "Error!"
+	fi
+	sleep 30
+done