GetConfig("AutoRestart"); if($AutoRestart){ $WorkPath = $App->GetConfig("DownloadPath"); $sql="select ID, ChannelName, Status, PID, FPID from channels where AutoRestart=1"; $st=$App->DB->prepare($sql); $st->execute(); $Data=$st->fetchAll(); for($i=0;$i0)$FileTime = filemtime($ts[0]);else $FileTime = 0; if(!file_exists("/proc/".$PID) || ( file_exists("/proc/".$PID) && !file_exists("/proc/".$FPID) && 300 <= time() - $FileTime && $FileTime > 0 )){ echo "Reastarting: ".$ChanID."\r\n"; $Msg="Channel: ".$Data[$i]["ChannelName"].", ID: ".$ChanID." restarted at: ".date("H:i A"); $sql="insert into notification (Title, Msg, Sent, Status) values ('Auto restart', '$Msg', now(), 'New')"; $App->DB->exec($sql); $App->StopDownload(array("ChanID" => $ChanID)); $App->StartDownload(array("ChanID" => $ChanID)); } } } } ?>