shell 远程连接服务器,shell脚本远程连接服务器并执行指定的shell脚本

shell脚本远程连接服务器并执行指定的shell脚本

发布时间:2020-08-19 14:35:20

来源:51CTO

阅读:1585

作者:素颜猪

1.脚本名称demo.sh

#!/bin/bash

yum -y install expect

expect -c "

spawn scp -r /Users/yunshuodeng/Work/mydocker/app/provider/power-dubbo-provider-1.0-SNAPSHOT.jar [email protected]:$1

expect {

\"*assword\"

{

set timeout 300;

send \"hntx123456\r\";

}

\"yes/no\"

{

send \"yes\r\"; exp_continue;}

}

expect eof"

expect -c "

spawn scp -r /Users/yunshuodeng/Work/mydocker/app/consumer/power-dubbo-consumer-1.0-SNAPSHOT.jar [email protected]:$1

expect {

\"*assword\"

{

set timeout 300;

send \"hntx123456\r\";

}<

你可能感兴趣的:(shell,远程连接服务器)