簡體   English   中英

最后使用帶有&符號的系統命令不會在后台運行該進程

[英]Using the system command with an ampersand at the end isn't running the process in the background

我正在打一個簡單的電話來恢復 mysql 備份,這需要大約 45 分鍾才能在我的一台服務器上完成。

system("mysql -u$user -p$pass $db < '$file' &");

以這種方式運行它會鎖定我的瀏覽器,我必須等到它完成才能做任何事情。 這在我的其他服務器上運行良好。 哪些設置可能會阻止它在第一台服務器上運行?

您仍然擁有 output 管道(stdout && stderr)的“句柄”,可以完全防止后台運行。

append a > /dev/null 2>&1到最后。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM