From 8f9fb58a13848a8f58b74130d6920c82d84e0b45 Mon Sep 17 00:00:00 2001 From: olli <> Date: Tue, 20 Aug 2024 17:52:41 +0200 Subject: [PATCH] remote group --- basics.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/basics.yml b/basics.yml index 50e8649..ddf627b 100644 --- a/basics.yml +++ b/basics.yml @@ -746,7 +746,8 @@ # If message should be sent by another host if [ -n "$tohost" ] then - echo "$message" | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -p33 $tohost " $(printf ' %q' "$@")" + [ -z "$togroup" ] && group="-g $(hostname)" + echo "$message" | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -p33 $tohost " $(printf ' %q' "$@ $group")" fi # Subject to message @@ -766,16 +767,17 @@ room=$(hostname) [ -n "$togroup" ] && room=$togroup room=${room// /} + room=${room//\\/} if ps ax | grep -v grep | grep -q synapse.app.homeserver then - if [ -p "/usr/local/share/$(hostname).fifo" ] + if [ -p "/usr/local/share/matrix-room-$(hostname).fifo" ] then matrix_message=$(echo "

${subj}

${orig_message}
") matrix_target="/usr/local/share/matrix-room-$(hostname).fifo" [ -n "$togroup" ] && [ -p "/usr/local/share/matrix-room-${room}.fifo" ] && matrix_target="/usr/local/share/matrix-room-${room}.fifo" echo "$matrix_message" | perl -pe 's/\n/
/' | perl -pe 's/\$/\n/; s/^\//;' >"$matrix_target" else - echo "$default group seems nit to exist" + echo "default group (/usr/local/share/matrix-room-$(hostname).fifo) seems not to exist" fi fi