0
我想在我的基於Linux的服務器上運行這個PHP腳本。運行一個無限循環的PHP文件
$today = strtotime("today");
$tommorow = date("Y-m-d", strtotime("+1day",$today));
$today = date("Y-m-d");
//Endless loop because the data here updates around the clock
while(1){
while (time() <= strtotime("$tommorw 8:00PM")){
sleep(30);
flush();
}
}//end 24 h loop
//save the file as a date file and delete it's content
//move on to the next day
$today = strtotime("today");
$tommorow = date("Y-m-d", strtotime("+1day",$today));
}//end of endless loop
它工作正常,如果我從一個簡單的瀏覽器運行它(當然,它會停止工作,當我關閉它)。
我想通過一個Perl腳本
chdir("mydir");
exec('indices.php'); #tryed also system("php indices.php");
運行它,像下面這樣運行
./PROMadadim.pl >> ./PROMadadim.log &
perl腳本,但是當我試圖從運行這是行不通的服務器。
其稱爲守護進程,谷歌「的PHP守護進程「 – 2012-06-21 21:56:54
你爲什麼說」它不工作「?具體發生了什麼?它運行但功能不正確?它不會運行嗎('ps -A'什麼都沒有顯示)? – webbiedave
設置一個cron作業。有無限循環幾乎沒有遠程通知。 – Ciro