in reply to Perl process to constantly detect the time change of a file?

To answer your question, use the sleep function in between each iteration. If you only sleep for a second or two each time through, you will save a boat load of cpu time.

If you can get away with just checking once per minute, and you are on some unix variant, you can run a script via cron.

On a broader note: This is a very long winded way of doing this. Instead of forking off a process and parsing the output, you can save a lot more CPU time (not to mention coding headaches) by using the stat function and just checking the mtime field.

bluto

  • Comment on Re: Perl process to constantly detect the time change on a file?