I have been trying to make this work for a while now. Whenever a new line is written, I'd like festival to read this line for me. Now I am not sure how to do this. Ive tried piping festival with tail -f but that does not work. Does anyone have suggestions? Currently I have this code:
tail -f /var/log/fail2ban.log |
awk '/^[0-9.]+[.][0-9]+$/{
if(!a[$0]++)print "Malicious IP adress " $0 " has been banned."}' RS="[ :/\n]" |
while read line; do
echo "$line" | festival --tts
done
I thought of saving every last line to a new file, for festival to read every few seconds, but this takes a lot of files and is probably more complicated than needed. I do think this should be possible, but I am not sure how.