【发布时间】:2011-09-25 15:15:15
【问题描述】:
我无法在 Amazon Linux 实例中运行后台进程,但同样可以在 Mac OS X 上运行
我正在尝试通过 cmd 行运行 php 脚本。 如果我最后不附加 & 字符,它在 Amazon Linux 上运行良好。 如果我附加 &,它有一个 T 作为它的 STAT
接下来会发生什么
[root@someIp somePath]# php /path/to/myPhpScript.php arg1 arg2 arg3 > /dev/null 2>log.txt &
[1] 17849
[root@someIp somePath]# jobs
[1]+ Stopped php /path/to/myPhpScript.php arg1 arg2 arg3 > /dev/null 2>log.txt
[root@someIp somePath]# bg 1
[1]+ php /path/to/myPhpScript.php arg1 arg2 arg3 > /dev/null 2>log.txt &
[1]+ Stopped php /path/to/myPhpScript.php arg1 arg2 arg3 > /dev/null 2>log.txt
[root@someIp somePath]#
但是如果我没有 & 运行它就可以了。
[root@someIp somePath]# php /path/to/myPhpScript.php arg1 arg2 arg3
Prints some output...
Prints some output...
Prints some output...
Prints some output...
Done...
[root@someIp somePath]#
同样的情况:https://forums.aws.amazon.com/thread.jspa?messageID=281552
谢谢!
【问题讨论】:
标签: linux amazon-ec2 background-process