Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send errors from logs to dev chat #28

Open
andrey-utkin opened this issue Feb 11, 2017 · 2 comments
Open

send errors from logs to dev chat #28

andrey-utkin opened this issue Feb 11, 2017 · 2 comments

Comments

@andrey-utkin
Copy link
Contributor

use sendxmpp and tail -F

@andrey-utkin
Copy link
Contributor Author

andrey-utkin commented Feb 11, 2017

#!/bin/bash
set -x

function say() {
	echo "$1" | sendxmpp --tls --tls-ca-path /etc/ssl/certs/ [email protected]

	# 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

@andrey-utkin
Copy link
Contributor Author

TODO:

  • run this as non-root user
  • autostart on boot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant