From a63865a10805873a03cdda90daaae6f477669102 Mon Sep 17 00:00:00 2001 From: boyska Date: Thu, 6 Apr 2023 12:46:49 +0200 Subject: [PATCH] versione iniziale --- README.md | 4 ++++ abbozzino/usr/local/sbin/abbozzino | 29 +++++++++++++++++++++++++++++ imbruttino/usr/local/bin/imbruttino | 12 ++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 README.md create mode 100755 abbozzino/usr/local/sbin/abbozzino create mode 100755 imbruttino/usr/local/bin/imbruttino diff --git a/README.md b/README.md new file mode 100644 index 0000000..ebcb41a --- /dev/null +++ b/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. diff --git a/abbozzino/usr/local/sbin/abbozzino b/abbozzino/usr/local/sbin/abbozzino new file mode 100755 index 0000000..e58b4cc --- /dev/null +++ b/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 diff --git a/imbruttino/usr/local/bin/imbruttino b/imbruttino/usr/local/bin/imbruttino new file mode 100755 index 0000000..e332bf8 --- /dev/null +++ b/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