How to trigger a script when a file arrives? #1745
Replies: 3 comments 1 reply
-
When you're setting up an action like this, there are three important things to consider:
We have a similar case of "trigger an action on file upload", and we use the following setup. Action definition:
Rule definition:
You could use the Name filters instead of Group if you prefer; we find groups to be tidier but it doesn't make much difference if you only have a few users. For your case, the Path filters would depend on whether users have isolated virtual dir setups or not. If they do (ie, user1 uploads to "/in", and user2 also uploads to "/in", but they're not the same directory) then you just need one Path filter: "/in/**". (It might be trickier if you let users create subdirectories, but we don't.) If they all see the same dir structure (user1 knows they're uploading to "/user1/in", user2 knows they're uploading to "/user2/in", etc) then you can either list them individually (if you only have a few users), or use a wildcard like "/user*/in/**". Obviously using a wildcard in the path risks matching a wider set than you expected, so be careful. Other things to be careful of:
|
Beta Was this translation helpful? Give feedback.
-
Hello, Thank you very much, this helped me a lot. |
Beta Was this translation helpful? Give feedback.
-
Hi everone, Thank you all for the explanation, following your tips i managed to trigger a python scrip with success, however whenever i try to bring up a container that is actually called from a bash script with parameters being sent from the server side, i get an error as described below: Bash script (test) Anyone out there that is calling docker containers from events / actions had simillar issues? Many thanks, Seb |
Beta Was this translation helpful? Give feedback.
-
Hi,
My need is to trigger a script, providing the arrival directory as a parameter, when a file arrives in a directory.
There are several directories /user1/in, /user2/in, /user3/in, ... .
User1, user2, ... connect to SFTPGo to upload files.
When a file arrives, from these users & in one of these directories, we must trigger a script new_file.ksh, with the parameter of the directory in which there is a file that has just arrived.
I tried putting the full path in the event rule, but nothing happens.
The Event action is OK, when i launch it with an Event rule on demand, the script is OK.
I think I don't understand how it works with the trigger Filesystem event.
My tests are done with version 2.5.6.
Can you help me?
Thanks in advance :)
Regards
PS: sorry for my English, it's not my native language.
Beta Was this translation helpful? Give feedback.
All reactions