Note: The version of tail which comes with most modern Linux distros can tail multiple files at once... just supply the multiple files as arguments, e.g.
Code:
tail -f /var/log/log1 /var/log/log2 /var/log/log3
tail will print a line like this when it swaps which file it is reading from:
Code:
==> /var/log/log1 <==
After that, it prints any new lines in the file. If the next activity is in the same file, the file name message is not re-printed, so you might want to keep track of this yourself, and use it as the title of your notify-send messages, e.g.
Code:
#!/bin/bash
file=unknown
tail -f log1 log2 |while read line; do
case "$line" in
==\>*\<==)
file="${line#==> }"
file="${file% <==}"
;;
*)
notify-send "$file" "$line"
;;
esac
done