0
我嘗試使用shell腳本在不同的服務器上執行命令塊運行Shell腳本塊使用SSH遠程
任何人都可以請幫我在這
while [ $RecordCount -gt 0 ]
do
expXXXXX=`sed -n ${RecordCount}p ${GUID_DLT_EXPR_FILE} | cut -d "|" -f1`
exprXXXXXn_id=`sed -n ${RecordCount}p ${GUID_DLT_EXPR_FILE} | cut -d'|' -f2`
run_dt=`sed -n ${RecordCount}p ${GUID_DLT_EXPR_FILE} | cut -d'|' -f3`
#START OF THE BLOCK - IN SERVER 2
if [ -d "/sas/ADH/exXd_$expXXXXX" ]; then
if [ -d "/sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id" ]; then
mv -f /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id/latest/* \
/sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id/archives
else
mkdir /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id
mkdir /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id/latest
mkdir /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id/archives
fi
else
mkdir /sas/ADH/exXd_$expXXXXX
mkdir /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id
mkdir /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id/latest
mkdir /sas/ADH/exXd_$expXXXXX/version_$exprXXXXXn_id/archives
fi
#END OF THE BLOCK - IN SERVER 2
done
exit 0
我試過下面的選項,並得到'不適當的ioctl dor設備'錯誤。 (ssh -t -t remoteserver << EOF) – user3299344
@ user3299344在重定向標準輸入時,請不要混合使用ssh的'-t'選項。試試'ssh $ {REMOTE_SERVER :?} echo ok'。如果失敗,遠程帳戶的環境會出現問題,如在shell初始化期間使用stty命令。 –