$inotify->blocking(0); ... $inotify->read; sleep 1s; if ($idle>$timelimit) { code(); };