I have multiple cameras sending images at random intervals via FTP to a predetermined folders.
For example:
recordings/camera1/images/ - for first camera
recordings/camera2/images/ - for second camera
etc
Each of them save images in .jpg format and then close FTP connection.
I need to call a PHP script after each time a new file is added. Let's say whenever a new image is added into the /recordings folder I need to call the php script with
newimage.php?location=recordings/camera1/images/picture002.jpg
and so on.
The server is a Linux box running ProFTPD
How I can get this done?
Please note: Cron job is not an option as there will thousands of files and we are not using a DB. So we cannot find out if there are any new files.
I would advise you to take a look at the mod_exec of ProFTPD. Here is a quote explaining its goal:
The mod_exec module can be used to execute external programs or scripts at various points in the process of handling FTP commands. By conscious design, ProFTPD does not and will not execute external programs. This is a security decision, as it was decided not to allow ProFTPD to serve as a means of compromising a system or disclosing information via bugs in external programs or scripts. Use of this module allows for such external programs to be executed, and also opens up the server to the mentioned possibilities of compromise or disclosure via those programs.
You can also take a look at inotify which offers you to monitor system file activity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With