Is there a way to run a script (or other executable) on a Linux server, triggered by a file upload to an Apache Httpd server via WebDAV (or at least something that can understand HTTP PUT)?
In addition, extra information (e.g. name of the Apache Httpd authenticated user) should be passed to this script, and it could run in the background, possibly for longer than the HTTP connection is up (e.g. the script could take about 10 minutes to run and doesn't need to provide a response to the user).
For example, let's assume that Apache Httpd is running under Linux user www-data and serving http://www.example/.
It would also be configured to have http://www.example/upload/ "address space" capable of handling WebDAV uploads (or HTTP PUT requests). http://www.example/upload/ would be protected by Apache Httpd authentication (e.g. htpasswd), with Httpd users userA, userB, userC, ...
When userA authenticates and uploads a file to http://www.example/upload/the_file, this files ends up on /some_upload_directory/the_file on the server.
Straight after being uploaded (or perhaps in a queue if necessary, if multiple uploads happen simultaneously), a script would be executed with parameters "userA" and "/some_upload_directory/the_file" (either as arguments or via environment variables).
This script would be run in the background and not necessarily be killed if the HTTP connection is terminated (at this stage, it would have nothing to do with the HTTP connection or Apache Httpd).
If possible, it would be preferable to run the script under a different Linux user than the Apache Httpd user (the same for all uploads, completely independent from the Apache Httpd users). Being able to set a maximum upload size on the front-end would also be good.
This sort of post-upload hook is available with some FTP servers. Any recommendation on how to do this using Apache Httpd? Is there something that could do this more or less out of the box, or would this require some programming? (I think I would prefer something that runs directly under Apache Httpd, or via CGI/FastCGI, but I guess running another server capable of doing this and using a reverse proxy might also be a solution.)