【发布时间】:2014-10-07 01:00:09
【问题描述】:
我有下面的代码..
ssh some_user@server << EOF
echo 'Successfully connected to the server'
pbrun previlige -u user
ls
pwd
id
...few more commands
EOF
if [ $? -eq 0 ]
then
echo 'Successful Execution of the last command in ssh'
fi
现在我在上面代码中遇到的问题是,通过pbrun命令切换用户后脚本自动退出(即它永远不会执行ls,pwd 和后续命令)。更复杂的是,这个问题是间歇性的。有时我得到所有后续命令的正确输出,有时却没有。
问题发生时的输出:
Successfully connected to the server
su from some_user to user at Mon Oct 6 09:47:00 MDT 2014
Successful Execution of the last command in ssh
在上述情况下,它在切换用户后从不显示命令的后续输出
问题未发生时的输出
Successfully connected to the server
su from some_user to user at Mon Oct 6 09:47:00 MDT 2014
Logs migrate.properties prereq.sh src_exp.sh src_mig.exp
/home/venus/
uid=* gid=* groups=****
Successful Execution of the last command in ssh
这有什么原因/解决方法吗?即使是解决方法对我来说也应该没问题..!谢谢!
【问题讨论】: