简体   繁体   English

执行shell脚本-永远的node.js

[英]Execute shell script - forever node.js

I am running forever scripts, I want control them via a website. 我永远运行脚本,我想通过网站控制它们。

if ($_GET['list']) {
    $list = shell_exec("forever list");
    echo ($list);
}

but the output is: 但输出是:

'No forever processes running'. “没有永远运行的进程”。

When I execute forever list on PuTTY it's working. 当我在PuTTY上执行forever list ,它就起作用了。 Su root didn't help. Su root没有帮助。

You should execute your PHP script as the same user that started the processes via forever, otherwise you will get this message saying that no processes are running. 您应该以永远启动进程的同一用户身份执行PHP脚本,否则您将收到此消息,提示没有进程在运行。

This other question will get you in the right direction; 这另一个问题将使您朝正确的方向前进; Running command-line application from PHP as specific user 以特定用户的身份从PHP运行命令行应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM