So this morning (yes, before breakfast) I awoke the beast of a poota to see a terminal tailing an error log. The tail command with -f flag outputs any changes made to a file, which is well handy to see live errors on your logfiles etc. So if you run something like this in your terminal:
tail -f /var/log/mysql/error.log
you would see any mysql errors as they happen, which is pretty cool, but you have to keep a terminal open, switch to it to see the errors etc, which lets be honest is a waste of clicks!
Back to this morning, I decided that I wanted my errors piped to a notification service and came up with:
tail -n0 -f ~/Documents/LOGS/adlink.co.uk.error.log | while read line; do notify-send "adlink.co.uk.error.log" "$line"; done
which pushes changes to the notification area, it’s visually lovely:
but quickly becomes a pain-in-the-arse for files that are active as each message must wait for the previous to disappear before appearing - resulting in an amazing amount of waiting. So I dug a little deeper and discovered a little program called osd_cat, with which I wrote this command:
which as you can see is a bit more nerdy and changes are reflected immediately and layered ontop of everything - perfect!
so what are you waiting for nerds? GET ON IT
EDIT - I knocked up a bash script that will tail all the error logs within a directory, so I now run this at startup:
# traverse the directory
for filename in *
# what's the filename?
# if it's an error log
if [[ $fname == *.error.* ]]
# tail the file and pipe it to osd_cat
tail -f $fname | osd_cat --pos bottom --offset 33 --color black --delay 10 &