Project

General

Profile

Feature #403 » monitor-fam.php

znerol znerol, 03/06/2010 05:22 AM

 
<?php

$path = "/tmp/test.txt";

function print_file()
{
echo("\n ****");
echo(file_get_contents($path));
echo("\n");
}

// create base and event
$famd = fam_open();
if ($famd === FALSE) {
print("could not connect to famd\n");
}

$mon = fam_monitor_file($famd, $path);
if ($mon === FALSE) {
print("failed to setup file monitor\n");
}

while(TRUE) {
$result = fam_next_event($famd);
if ($result['code'] == FAMChanged) {
print_file();
}
}
?>

(2-2/5)