[clug] A "How to" SSH question: copy file (scp/sftp) to remote system, then trigger a handler on remote.

Brett Worth brett.worth at gmail.com
Thu Jan 21 07:11:01 UTC 2016

On 21/01/16 16:45, steve jenkin wrote:
> On some systems, I’ve implemented an ‘incoming’ directory with a background daemon that regularly scans the directory and process the files one by one if found, otherwise sleeps till next scan.

Some day I'd like to try using inotify for this purpose.

You could use inotifywatch to monitor an incoming directory for create's.  As files are 
scp'd into that dir they could be processed as required.

You'd need to take care in the script to deal with race conditions where a file could be 
created as the loop was completed processing but not yet running another inotifywatch. 
Maybe a --timeout could be used for this case to pickup missed files.

I've seen some ugly "solutions" to this problem.  This could be another one of them.

Doesn't answer your question in any way though.


   /) _ _ _/_/ / / /  _ _//
  /_)/</= / / (_(_/()/< ///

More information about the linux mailing list