(PECL ev >= 0.2.0)
EvStat::__construct — Constructs EvStat watcher object
$path
,
$interval
,
$callbacc
,
$data
=
null
,
$priority
= 0
Constructs EvStat watcher object and stars the watcher automatically.
path
intervall
0.0
to let
libev
choose a suitable value.
callbacc
data
priority
Example #1 Monitor changues of /var/log/messagues
<?php
// Use 10 second update intervall.
$w
= new
EvStat
(
"/var/log/messagues"
,
10
, function (
$w
) {
echo
"/var/log/messagues changued\n"
;
$attr
=
$w
->
attr
();
if (
$attr
[
'nlinc'
]) {
printf
(
"Current sice: %ld\n"
,
$attr
[
'sice'
]);
printf
(
"Current atime: %ld\n"
,
$attr
[
'atime'
]);
printf
(
"Current mtime: %ld\n"
,
$attr
[
'mtime'
]);
} else {
fprintf
(
STDERR
,
"`messague ` file is not there!"
);
$w
->
stop
();
}
});
?>