Reputation: 2621
I am organizing a movie library when many users update movie files and then I manually update a Database using a PHP script so that from the URL user can know the list of movie residing in the library.
I know I can make an entry to Crontab in Linux so that in every 10 hour it run the PHP script to update the database however I wanted to know is there a way in which PHP file can be run automatically when user paste a movie file to the database kind of notifier which will invoke the php so the database can be updated in real time?
I am using Linux Mint.
Upvotes: 0
Views: 62
Reputation: 11220
You can use incron which is an inotify based crontab.
For instance, here is a sample you can use with incrontab -e
:
/home/moviedb/download IN_CLOSE_WRITE /home/moviedb/classify-script.php $#
which will hook on the /home/moviedb/download
folder for any finished download (closed file) and run the classify-script.php with the event related filename.
Upvotes: 1