In article <[EMAIL PROTECTED]>,
Paul Miller <[EMAIL PROTECTED]> wrote:
>
>How can you 'watch' a file as it is being written to?  For example, I want
>to have a script watch a log files for certain information and do
>something when it sees the information.

Ah, basic shell programming question :)

Something like:

---------------------------------

#! /bin/sh

tail -f /var/log/messages | (
  while read line
  do
        case "$line" in
                *emergency*)
                        echo "EMERGENCY: $line" > /dev/console
                        ;;
                *"ippp0: dialing"*)
                        echo "DIALING: $line" > /dev/console
                        ;;
        esac
  done
)
---------------------------------

Well, you get the idea ..

Mike.
-- 
 Miquel van Smoorenburg |  
    [EMAIL PROTECTED]  |  Luck is when preparation meets opportunity


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .

Reply via email to