On Tue, May 11, 2010 at 08:21:07PM +0200, Christoph Sievers wrote:
> if I wanted to scp each file that is written within a certain
> directory I'd use an incrontab line like
> /home/sync/ IN_CLOSE_WRITE /usr/bin/scp $@$# sync_at_anotherhost
> I'm also using SSH ControlMaster so that I do not open more than one
> ssh connection (the Master is opened by Autossh beforehand).
> Problem:
> Unfortunately someone copies 30 thousand files to /home/sync which
> results in a lot of processes and a lot of things go wrong then. How
> do I can I solve this?
Use IN_NO_LOOP. This will fire one process and not do it again until that
one exits. Have your script loop until there's nothing more to do.
There's a minor race condition -- a file could be written after the process
last checks and the next one is fired. If events happen frequently enough,
that should't be a problem in practical use. (The next run will get it.)
-- Matthew Miller blocked-address <http://mattdm.org/>Received on Tue Jun 05 2012 - 22:14:21 CEST
This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 22:14:21 CEST