2019独角兽企业重金招聘Python工程师标准>>>
ssh 远程删除
expect -c "
spawn ssh -t user@IP rm -fr ~/daily_binary/dailybuildapks/*
expect {
\"*assword\" {set timeout 300; send \"password\r\";}
\"yes/no\" {send \"yes\r\"; exp_continue;}
}
expect eof"
scp 远程拷贝
expect -c "
spawn scp -r /home/jenkins/ user@192.168.0.188:~/daily_binary/dailybuildapks/
expect {
\"*assword\" {set timeout 300; send \"password\r\";}
\"yes/no\" {send \"yes\r\"; exp_continue;}
}
expect eof"
rsync 远程同步
rsync --progress -e 'ssh -p 28866' -av --exclude=jobs --exclude=workspace jenkins@10.0.11.68:/home/jenkins/.jenkins/ ./
rsync -av -e "ssh -p 1115" --exclude=".gradle/caches" ./.gradle jenkins@10.192.39.86:/home/jenkins/ 挂载缓存