目录
shell jfrpg上传下载文件脚本
重名名
vim /root/.bashrc
alias pull='sh /opt/helloWorld/pull.sh'
alias push='sh /opt/helloWorld/push.sh'
alias getandupload='sh /opt/helloWorld/getandupload.sh'
//加载配置生效
source /root/.bashrc
pull 下拉脚本
vim pull.sh
#!/bin/bash
filePath=$1
curl -u ecs_read:ecs_read -O ${filePath}
tmpPath=`echo ${filePath} | awk -F "96:8081" '{print $2}'`
tmpFile=`basename ${tmpPath}`
vim $tmpFile
//使用
pull http://192.168.48.96:8081/artifactory/ecs2_java_prod/cicd/ecs/tests/nginx.conf
push 推送脚本
vim push.sh
#!/bin/bash
filePath=$2
tmpFile=$1
curl -X PUT -u liwenchao:liwenchao -T ${tmpFile} ${filePath}
//使用
push nginx.conf http://192.168.48.96:8081/artifactory/ecs2_java_prod/cicd/ecs/tests/nginx.conf
getandupload 下拉修改后5秒上传
#!/bin/bash
filePath=$1
curl -u `cat .env` -O ${filePath}
tmpPath=`echo ${filePath} | awk -F "96:8081" '{print $2}'`
tmpFile=`basename ${tmpPath}`
vim $tmpFile
echo "I will upload the file after 5 seconds"
sleep 5
curl -X PUT -u `cat .env` -T ${tmpFile} ${filePath}
rm -rf ./$tmpFile
//使用
getandupload http://192.168.48.96:8081/artifactory/ecs2_java_prod/cicd/ecs/tests/nginx.conf
标签:pull,tmpFile,shell,filePath,上传下载,vim,push,sh,jfrpg
From: https://www.cnblogs.com/liwenchao1995/p/16800620.html