ssh execute background jobs remotely

ssh远程执行后台作业时,在命令行最后添加&标识并不是太好用,ssh还是会挂起,无法正常退出,可以使用nohup,并且重定向其所有的三个标准输入输出来解决:

ssh -T server << EOF
  nohup foobar >/dev/null 2>&1 </dev/null &
EOF

References:
[1]nohup

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.