//View Tip #220
» Graph connections to hosts
» Crawl a web page for links
» Get latest stable version of the Linux kernel
» Sort a file by line length
Similar Tips
» Being selfish - Kick all users except you» Graph connections to hosts
» Crawl a web page for links
» Get latest stable version of the Linux kernel
» Sort a file by line length
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
This is a way to monitor "/var/log/messages" or any file for certain changes.
The example below actively monitors "stuff" for the word "now" and as soon as "now" is added to the file, the contents of msg are sent by email
The example below actively monitors "stuff" for the word "now" and as soon as "now" is added to the file, the contents of msg are sent by email
$ tail -f stuff | awk ' /now/ { system("mail -s \"Now Occured\" mail@foo.com < msg") }'Comments
Add your comment
No Comments

