[GTALUG] Watching a network folder: is there a smart way of doing this?

David Collier-Brown davec-b at rogers.com
Sat Feb 25 09:40:57 EST 2017


On 24/02/17 11:21 PM, Scott Elcomb via talk wrote:
> On Fri, Feb 24, 2017 at 9:24 PM, Stewart C. Russell via talk
> <talk at gtalug.org> wrote:
>> On 2017-02-20 12:47 AM, Aruna Hewapathirane wrote:
>>> Hi Stewart, you could just |watch| the file listing (adjusting n seconds
>>> to whatever is suitable)
>>>
>>> |watch --differences -n 10 ls -l </path/to/shared/dir>|
>> I hadn't heard of watch before, so thanks! watch *started* to work
>> really well, but then went into a terminal sulk after the FS disappeared
>> during a scan, and refused to show any updates. It's also an interactive
>> program, so doesn't pipe or notify changes in any useful way.
>>
>> I suspect I'll just have to go with William Park's suggestion of using
>> rsync to a local folder that I have more control over. I still have to
>> correct for the scanner FS's wandering clock, but that's less important.
> Here's a quick and dirty bash script similar to the watch command;
> adjust to taste. :-)
>
> [- watchdir.sh snippet starts -]
> [- watchdir.sh snippet ends -]
>
I have a similar function named "waitfor", as it's typically used to 
wait for a file to stop changing, like

$ do_something >foo &
$ waitfor foo && mailx -s "do_something completed" davecb <foo


-- 
David Collier-Brown,         | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net           |                      -- Mark Twain



More information about the talk mailing list