[英]Execute shell command run php in background
I run a php script through shell using the following:我使用以下命令通过 shell 运行一个 php 脚本:
php script.php
How do I type this command in order to run it on the background and also log the output to a file?如何键入此命令以便在后台运行它并将输出记录到文件中?
I've tried我试过了
php script.php 2>&1 > out.log
But once I close putty, the script stopped.但是一旦我关闭腻子,脚本就停止了。
you can use nohup (no hang up)你可以使用nohup (不挂断)
nohup php script.php 2>&1 > out.log
or you use cron or at to run your script in background或者您使用 cron 或 at 在后台运行您的脚本
在命令后添加&
。
尝试这样调用:
php script.php 2>&1 > out.log &
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.