在本地机器上执行 ssh target "nohup ./test.sh &",结果ssh不立即退出,等test.sh执行完毕之后才退出。一般我们使用nohup命令是为了在断开到某个服务器的ssh连接之后,之前执行的命令仍然正常地在服务器运行

  解决的方法是,手动在命令里面指定重定向,即上面的命令换成:ssh target "nohup ./test.sh >/dev/null 2>&1 &",然后就OK。下面的分析表明了nohup命令与“ssh host "cmd"”方式的ssh命令没有任何关系(因为这种方式不会涉及SIGHUP),所以换成ssh target "./test.sh >/dev/null 2>&1 &" 就可以了

 

http://blog.csdn.net/oneinmore/article/details/50073443

相关文章:

  • 2021-11-12
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
猜你喜欢
  • 2022-03-07
  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2021-11-12
相关资源
相似解决方案