ssh -t

ssh -t

man ssh
	...
     -T      Disable pseudo-terminal allocation.

     -t      Force pseudo-terminal allocation.  This can be used to execute arbitrary screen-based programs on a remote machine,
             which can be very useful, e.g. when implementing menu services.  Multiple -t options force tty allocation, even if
             ssh has no local tty.
	...
# cat test.sh
echo 'aa' > /test.log
sleep 14
echo 'bb' >> /test.log
nohup sleep 10086 &
nohup echo 'dd' >> /test.log &
echo 'cc' >> /test.log
sleep 2
# nohup ... & 后面sleep一下 避免出现脚本退出 nohup还没有执行生效

ssh -t ip “sh test.sh” 耗时 14+2
ssh -T ip “sh test.sh” 耗时 14+2+10086
(不带参数默认是 -T)

你可能感兴趣的:(Linux)