in reply to waiting until a file updates...

As an alternative to flocking you could write a lock file before the fork. This is removed by the child after the update is complete. The parent just has to wait arround until the lock file is gone to be sure that the update has gone OK. Lockfiles are a bit more portable than flock.

my $lockfile = '/var/lock/mylockfile'; open L, $lockfile; close L; die "Can't generate lockfile $!" unless -e $lockfile; my $pid = fork(); if ( $pid == 0 ) { # child my $error = update_somefile(); die $error if $error; unlink $lockfile or die $!; # more stuff } elsif ( $pid ) { # parent my $timeout = 0; while ( -e lockfile ) { sleep 1; $timeout++; die "of old age waiting for child to finish update" if $timeou +t > $whatever_time; } # lockfile gone, child has completed update so... } else { die "Fork failed!\n"; }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print