One can monitor for changes to files & directories, including events like open, close, new file, delete, rename & all other file/directory operations.
The following code snippet should be self-explanatory:
[php]
<?
$data_file = ‘/var/data/my_data_file.txt’;
$inotify_fd = inotify_init();
$watch_descriptor = inotify_add_watch($inotify_fd, $data_file, IN_OPEN);
while (1)
{
$events = inotify_read($inotify_fd);
$filepath = $events[‘name’];
print “File opened”;
}
inotify_rm_watch($inotify_fd, $watch_descriptor);
fclose($inotify_fd);
?>
[/php]
While implementing Google AMP (Accelerated Mobile Pages) for your website, it might occur to you…
Thinking of buying the JioFi device by reliance or to be precise any device by…
Do you hate those pesky javascripts. Majority of the banking, utility bill payment etc so…
So amazon has this amazing feature called whispersync : If you read the same Kindle…
Getting a new HTC One left me wondering how will I move Google Authenticator from…
Get Bad Company 2, ME: Infiltrator, etc for free Free Games you can get today:…