1

我将以下 rsh 代码作为脚本的一部分。此代码在主脚本内循环运行。如果 rsh 失败,我希望在为其创建以下 If 部分的日志中捕获退出代码。但它似乎并没有工作,因为它总是返回 0 美元?即使远程服务器拒绝连接。

我不能使用 ssh,因为它没有配置。

rsh ${machine} -l ${osusernm} nohup ${ScrDir}/${LoadJobNm}.scr ${osusernm} ${machine} ${SIDFile} ${logon_id} ${calling_machine} &
           if [ $? -ne 0 ]
                    then
                    echo "ERROR : Failed to execute ${LoadJobNm}.scr in ${machine} for file ${SIDFile}" >> ${LogDir}/${JobNm}.log 
                    break
           fi
4

0 回答 0