开发者

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

I'm making a simple call to restore a mysql backup that takes about 45 minutes to complete on one of my servers.

开发者_如何学编程
system("mysql -u$user -p$pass $db < '$file' &");

Running it that way locks my browser and I have to wait until it's finished before I can do anything. This works fine on my other server. What settings could be preventing that from working on the first server?


You still have the "handle" to the output pipes (stdout && stderr) which prevents backgrounding fully.

append a > /dev/null 2>&1 to the end.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜