Hi Everyone!

I hope you can help me.

I need to create a daemon (shell or perl script) to monitor a log file and read it line by line, in order to find specific words or lines (in this case have to read serial numbers), to be able to compare them with serial numbers in a postgres data base, and show an alert (or something similar) when the serial number in the log file and data base are the same. In other words, must not have repeated numbers in the log file, according with postgres data base.

What I need is something like: tail -f logfile.log, and detect the line: serial: A2CXXXX and evaluate if there is this serial number in the data base. Obviously need to connect to the database y make a query, in order to know if the serial number is in the database or not.

But this script needs to be running without interruptions, because the log is being filled with more data and serial numbers.

This script has to be like a daemon, because the log file is being written all day long.

I hope this is clear, and you guys can help me.

Best Regards and Thanks in advance!!