Chinaunix
标题:
here document阻塞了
[打印本页]
作者:
sophistcxf
时间:
2016-01-22 12:25
标题:
here document阻塞了
本帖最后由 sophistcxf 于 2016-01-22 15:38 编辑
在机器IP1上有如下两个脚本
ipt1_test1.sh
while [ 1 ]
do
echo "sleep"
sleep 10
done
复制代码
ip1_test.sh
nohup sh test1.sh 1>test.nohup 2>&1 &
复制代码
在机器IP2上有如下脚本
ip2_test.sh
ssh -T username@IP1 <<EOF
cd integratesrv/bin
#nohup ./integratesrv_put_hbase.sh &
#nohup sh test.sh 1>test.nohup 2>&1 &
sh test.sh
echo "dd"
EOF
echo $?
复制代码
此时在IP2上执行sh ip2_test.sh,脚本很快退出,并且IP1上留有ip1_test1.sh。
如果ip1_test.sh改为如果,去掉重定向。
nohup sh test1.sh &
复制代码
此时在IP2上执行sh ip2_test.sh,脚本则退出不了,并一直打印sleep。
请问为什么ip1_test.sh加重定向和不加重定向会造成这种差异?我猜想管道有关,但想不通为什么。
作者:
jason680
时间:
2016-01-22 12:30
http://bbs.chinaunix.net/thread-4138810-1-1.html
作者:
sophistcxf
时间:
2016-01-22 15:38
多谢提醒,已重新编辑问题.
回复
2#
jason680
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2