From f65ff48599886a3930b97bcd2f6f675b071a4532 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Mon, 27 Jul 2026 17:09:26 +0200 Subject: [PATCH] =?UTF-8?q?fix(cron):=20pipe=20alle=20n=C3=A4chtlichen=20c?= =?UTF-8?q?rons=20durch=20notify.sh=20zur=20verhinderung=20von=20telegram?= =?UTF-8?q?=20spam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/fix-crons.sh | 24 ++++++++++++++++++++++++ deploy/notify.sh | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 deploy/fix-crons.sh diff --git a/deploy/fix-crons.sh b/deploy/fix-crons.sh new file mode 100644 index 0000000..93ddd2a --- /dev/null +++ b/deploy/fix-crons.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -e + +# Alte Crons löschen +hermes cron remove traum || true +hermes cron remove chef-gutachter || true +hermes cron remove release-radar || true +hermes cron remove idle-radar || true +hermes cron remove selbst-inventur || true +hermes cron remove karten-gutachter || true +hermes cron remove pruefstand || true +hermes cron remove trend-radar || true + +# Neue Crons registrieren mit --no-agent und pipe in notify.sh +hermes cron create traum "15 3 * * *" "bash /home/hitonabi/mission-control-v2/deploy/dreaming-feed.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Traum" --no-agent +hermes cron create chef-gutachter "30 4 * * *" "bash /home/hitonabi/mission-control-v2/deploy/chef-gutachter-feed.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Chef-Gutachter" --no-agent +hermes cron create release-radar "15 5 * * 1" "bash /home/hitonabi/mission-control-v2/deploy/hermes-release-radar-feed.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Release-Radar" --no-agent +hermes cron create idle-radar "45 3 * * *" "bash /home/hitonabi/mission-control-v2/deploy/idle-radar-feed.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Idle-Radar" --no-agent +hermes cron create selbst-inventur "35 3 * * *" "bash /home/hitonabi/mission-control-v2/deploy/selbst-inventur.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Selbst-Inventur" --no-agent +hermes cron create karten-gutachter "0 4 * * *" "bash /home/hitonabi/mission-control-v2/deploy/karten-gutachter.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Karten-Gutachter" --no-agent +hermes cron create pruefstand "0 2 * * *" "bash /home/hitonabi/mission-control-v2/deploy/pruefstand/pruefstand.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Prüfstand" --no-agent +hermes cron create trend-radar "15 5 * * 6" "bash /home/hitonabi/mission-control-v2/deploy/trend-radar-feed.sh | bash /home/hitonabi/mission-control-v2/deploy/notify.sh -s Trend-Radar" --no-agent + +echo "Crons erfolgreich gefixt!" diff --git a/deploy/notify.sh b/deploy/notify.sh index 5a2561c..c8c294c 100644 --- a/deploy/notify.sh +++ b/deploy/notify.sh @@ -22,8 +22,8 @@ shift $((OPTIND - 1)) MSG="${1:-}" [ -z "$MSG" ] && [ ! -t 0 ] && MSG="$(cat)" if [ -z "$MSG" ]; then - echo "usage: notify.sh [-s subject] " >&2 - exit 2 + # Bei leerer Pipe-Eingabe lautlos beenden (wichtig für Cron-Skripte ohne Ausgabe) + exit 0 fi TS="$(date '+%Y-%m-%d %H:%M:%S')"