如何在node.js中创建和使用后台作业?
我遇到过两个库(node-resque和node-worker),但想知道是否有更多的东西使用.
我编写了一个nodejs函数来执行'nohup'命令,并将成功结果作为http响应发送.
function _nohup(cmd,res){
var child = exec('nohup ./' + cmd + '.sh &',
function (error, stdout, stderr) {
res.writeHeader(200);
res.end("start process success!");
});
}
Run Code Online (Sandbox Code Playgroud)
但是当我通过url地址调用函数时,响应数据无法返回.