Re: 'watching' a file
In article <[🔎] Pine.LNX.3.96.980304180328.23193A-100000@serv1.3dillusion.com>,
Paul Miller <paul@3dillusion.com> 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 |
miquels@cistron.nl | Luck is when preparation meets opportunity
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: