$ cat pm_1198604.pl
use strict;
use warnings;
system("touch FName.dat");
my $ctime = (stat 'FName.dat')[10];
# Proxy for your spreadsheet update...
system("(sleep 10; date; touch FName.dat) &");
my $timeout = time + 60; # Don't wait forever!
while (1) {
# File changed yet?
my $new_ctime = (stat 'FName.dat')[10];
last if $new_ctime > $ctime;
die "TIMEOUT!" if time > $timeout;
print "still unchanged, waiting a little while\n";
sleep 2;
}
print ".. continuing to next chunk of work\n";
$ perl pm_1198604.pl
still unchanged, waiting a little while
still unchanged, waiting a little while
still unchanged, waiting a little while
still unchanged, waiting a little while
still unchanged, waiting a little while
still unchanged, waiting a little while
Sun, Sep 3, 2017 11:35:11 AM
.. continuing to next chunk of work
...roboticus
When your only tool is a hammer, all problems look like your thumb. |