[shell] [AIX] 远程运行脚本

远程登录系统并执行任务返回结果

  ssh -q host

root@redhat8:/usr/bin/script/ $ cat export_role.sh
#!/bin/bash
# Script to ge the value of parameter in all systems
cd /usr/bin/script/echo $PWD

echo " Run this script as a root user "
echo " export oracle user list "
echo " continue?(y/n) : "

read answer

if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
 exit
fi

starttime=`date +%s` #start run time
echo "$starttime"

while read -r USER OACLESID
        do
                {
                respond=$(ssh -q redhat${ORACLESID}a0  "/usr/bin/script/export_role.sh $USER $OACLESID")
                echo -e "${ORACLESID}: ${respond}"
                unset respond
                }&
        done < ./oracle_system.lst
        wait
endtime=`date +%s`  #end run time
echo " TIME: `expr $endtime - $starttime` "

 

 

posted on 2020-03-17 22:39  InnoLeo  阅读(437)  评论(0编辑  收藏  举报