Monitoring file - perl?

  • Thread starter Thread starter dave r
  • Start date Start date
D

dave r

Guest
hello people
I want to make a code which
monitors a file
i have file called rules.txt & log.txt
if a string in rules.txt matched with one of the requests in the logfile
i will get an alert...
so what shall i use to make the script keep watching the file (forever)
 
One way is to run it as a cron job (for example, every minute).

Otherwise, you can create an indefinite loop in your perl script. You'll probably want to use sleep function to give it some delay after each iteration. Then you can run it as a daemon using the & at the command line.

Hope this helps.
 
Back
Top