Skip to content

Instantly share code, notes, and snippets.

@jemygraw
Created January 24, 2015 09:00
Show Gist options
  • Save jemygraw/2453bc1181a81876c766 to your computer and use it in GitHub Desktop.
Save jemygraw/2453bc1181a81876c766 to your computer and use it in GitHub Desktop.
curl&qbox upload test script
echo -e "curl\tqboxrsctl"
#set variables
uploadFile="/home/jemy/Documents/qiniu.png"
uploadHost="upload.qiniu.com"
uploadToken="ELUs327kxVPJrGCXqWae9yioc0xYZyrIpbM6Wh6o:YEZCdEInhP2a-4Whb_D23nPl6b4=:eyJzY29wZSI6ImlmLXBibCIsImRlYWRsaW5lIjoxNDIyMDkxOTk3fQ=="
uploadBucket="if-pbl"
uploadTimes=1000
curlPrefix="curl_pic"
qboxPrefix="qbox_pic"
for((i=1;i<=$uploadTimes;i++));do
#curl
startTime=$(date +%s.%N)
curl --silent -F "key=${curlPrefix}_${i}" -F "token=$uploadToken" -F "file=@$uploadFile" $uploadHost > /dev/null
endTime=$(date +%s.%N)
curlLastTime=$(echo "$endTime-$startTime"|bc -l)
#qboxrsctl
startTime=$(date +%s.%N)
qboxrsctl put $uploadBucket $qboxPrefix"_${i}" $uploadFile > /dev/null
endTime=$(date +%s.%N)
qboxLastTime=$(echo "$endTime-$startTime"|bc -l)
echo -e $curlLastTime "\t" $qboxLastTime
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment