while(1) { $status = check(); if($check) { $pid = fork(); unless($pid) { somthing(); return; } else { wait(); } }