ssh 远程命令不返回 [英] ssh remote command does not return

查看:122
本文介绍了ssh 远程命令不返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 ssh somehost "service XXX restart" 并且外壳挂起.

I am running ssh somehost "service XXX restart" and the shell hangs.

服务是 nodeJS,我看到 express 正在监听端口 ... 打印我在 server.js 中制作的,就是这样,它没有返回提示,它只是挂起.

The service is nodeJS and I see express is listening on port ... print I made in server.js and that's it, it does not return to prompt, it simply hangs.

我尝试过 nohup 和 &但它没有帮助.我还能尝试什么?

I tried nohup and & but it does not help. What else can I try?

推荐答案

原来使用 -t 解决了这个问题.

turns out that using -t resolves the issue.

ssh -t root@somehost "service XXX restart" 不会挂起.

评论中可能解决此问题的其他建议:

other suggestions from the comments that might resolve this:

  • node myScript.js &否认
  • exec node myScript.js &

这篇关于ssh 远程命令不返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆