in reply to Re^3: grep confusion
in thread grep confusion
You could use stat to get the file modification time, and then sit in a loop waiting for the file modification time to change:
$ 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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: grep confusion
by PriNet (Monk) on Sep 03, 2017 at 19:37 UTC | |
by PriNet (Monk) on Sep 11, 2017 at 03:05 UTC | |
|
Re^5: grep confusion
by PriNet (Monk) on Sep 03, 2017 at 17:07 UTC |