码迷,mamicode.com
首页 > 其他好文 > 详细

jenkins 更新脚本之expect交互

时间:2019-08-13 15:27:39      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:url   key   脚本   %s   binary   purge   out   item   spawn   

#!/bin/bash
username=shuyouyun
apiKey="shuyounbkey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
expect << EOF
set timeout 500
spawn ssh -o StrictHostKeyChecking=no root@192.168.1.1
expect "password" {send "shuyounb@110"}
expect "#" {send "cd /home/client\r"}
expect "#" {send "zip -rp game`date +"%Y%m%d%H"`.zip game\r"}
expect "#" {send "cd game\r"}
expect "#" {send "svn up\r"}
expect "#" {send "cd game\r"}
EOF
curl -i --url "http://open.chinanetcenter.com/ccm/purge/ItemIdReceiver" \
-X "POST" \
-u "$username:$password" \
-H "Date:$date" \
-H "Content-Type: application/xml" \
-d‘<?xml version="1.0" encoding="utf-8"?>
<purge>
<dirs>
<dir>https://www.nb.com/</dir>
<dir>http://www.nb.com/</dir>
<dir>http://www.nb.com/</dir>
</dirs>
<dir-action>expire</dir-action>
</purge>‘

jenkins 更新脚本之expect交互

标签:url   key   脚本   %s   binary   purge   out   item   spawn   

原文地址:https://www.cnblogs.com/capable/p/11345838.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!