true,"running"=>$p&&file_exists("/proc/".trim($p)),"log"=>substr(@file_get_contents($lf)?:"",-100)]);} elseif($act=="start"){file_put_contents($lf,date("c")." START\n");shell_exec("nohup bash -c 'echo \$\$ > $pf; for i in $(seq 1 $dur); do echo tick_\$i >> $lf; sleep 1; done; echo DONE >> $lf; rm -f $pf' &>/dev/null &");usleep(300000);echo json_encode(["ok"=>true,"started"=>true,"pid"=>trim(@file_get_contents($pf))]);}