2

I am trying to get libnotify (notify-send) to pop-up a notification once a certain character is found while I tail a log file.

Without grep it works fine ...

Here is my code:

 tail -f /var/log/mylogfile | grep ">" | while read line; do notify-send "CURRENT LOGIN" "$line" -t 3000; done

When I include grep it passes nothing to notify-send. The code above I modified from https://ubuntuforums.org/showthread.php?t=1411620

Also, how can I change the font size?

4

This page explains grep and output buffering, in short you want to use the --line-buffered flag:

tail -f /var/log/mylogfile | grep --line-buffered ">" | while read line; do notify-send "CURRENT LOGIN" "$line" -t 3000; done

About the font, this AskUbuntu question mentions it's not officially possible, but describes a tool notifyosdconfig that allows some modifications.

  • That did the trick ... thank you ... the font is not really important ... just a little too small ... – Danny Aug 10 '16 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.