Jan Laustsen wrote:
> 
> Hello all :)
> 
> I suppose this question is in the wrong mailinglist, but i thought i would give it a 
>try anyways, i hope you forgive me :)
> 
> If i want a perl script to check a file every 30 seconds, how do i tell the script 
>to wait 30 seconds before it checks the file ?
> 
> Thanks. //Jan

I am sorry, I don't know anything about perl, but recently I
experimented a little bit with awk. Perhaps you can use such a script to
do your job or translate it.

This would be my suggestion:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

BEGIN{
for (i=0; i<100; ++i){
/* check you file or whatever */
    n0=systime()
    n1=systime()
    while ((n1-n0)<30){
          n1=systime()
    }
}
exit}

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

systime() returns the time of day in seconds.
n0 = time when you start to wait
n1 = new time, and is updated as long as the difference is smaller than
30 (seconds)
In this example your file is checked 100 times. You can make it do it as
many times you like, ofcourse, or program another type of loop.

Suppose you named this file check_file.awk, you can run it f.i. by 
awk -f check_file.awk

I hope that this is of any use. I am certain that this not the most
elegant solution, since it results in a significant load on your
machine, but it may be a start.

Lucas

Reply via email to