Open andrey-utkin opened 7 years ago
#!/bin/bash
set -x
function say() {
echo "$1" | sendxmpp --tls --tls-ca-path /etc/ssl/certs/ andrey.utkin@decent.im
# Failure injection and testing
#echo "$1"
#return $((RANDOM % 2)) # failure injection
}
export -f say
function say_retrying() {
for x in `seq 1 10`
do
say "$@" && break
date
echo "Retrying transmission of $@"
sleep 60
done
}
export -f say_retrying
xargs -n1 -d'\n' -I {} bash -c 'say_retrying "$@"' _ {}
tail -F -n0 /var/log/jabber/prosody.err | grep '^[A-Z]' | buffer | ~/log_to_sendxmpp.sh
TODO:
use
sendxmpp
andtail -F