Curl命令执行Http

@echo off
del /q *.csv
echo set echo off;>monitorsh.sql
echo set feedback off;>>monitorsh.sql
echo set trimspool on;>>monitorsh.sql
echo set trimout on;>>monitorsh.sql
echo set linesize 1200;>>monitorsh.sql
echo set pagesize 2000;>>monitorsh.sql
echo set newpage 1;>>monitorsh.sql
echo set heading on;>>monitorsh.sql
echo set term off;>>monitorsh.sql
echo set termout off;>>monitorsh.sql
echo set timing off;>>monitorsh.sql

echo spool monitorsh.csv >>monitorsh.sql

echo select from (select substr(min(submittime),1,16),substr(min(submittime),1,10) a,replace(max(submittime),' ','+'),'黑名单审核',count() hz from T_BLACKSERVICECODE_CMPP >>monitorsh.sql
echo union select substr(min(submittime),1,16),substr(min(submittime),1,10) a,replace(max(submittime),' ','+'),'关键字审核',count() hz from T_BLACKWORD_CMPP >>monitorsh.sql
echo union select substr(min(submittime),1,16),substr(min(submittime),1,10) a,replace(max(submittime),' ','+'),'普通审核',count(
) hz from T_CHECK_CMPP ) >>monitorsh.sql
echo left join c_zbb on riqi=a >>monitorsh.sql
echo where hz^>3000; >>monitorsh.sql

echo spool off >>monitorsh.sql
echo exit>>monitorsh.sql
sqlplus yw2018/"""yw2018.i314"""@ywpt_172.30.9.154 @monitorsh.sql

tail -20 monitorsh.csv|find "201" >monitorshend.csv

for /f "tokens=1-8 delims= " %%s in (monitorshend.csv) do (
echo 【异网平台】%%w页面积压%%x条!>E:\JYJ\newplatcontrol\shenheMonitor\sh.txt
echo 上次审核:%%t>>E:\JYJ\newplatcontrol\shenheMonitor\sh.txt
echo 审核人:%%z!>>E:\JYJ\newplatcontrol\shenheMonitor\sh.txt
for /f %%i in (mobile.txt) do (
curl -G --data-urlencode content@E:\JYJ\newplatcontrol\shenheMonitor\sh.txt "http://172.30.9.151:9112/httpServer/http/sendSms?account=szap&reqNo=201707025105050001&authCode=CB989004546CB6C1EC45E8A858BCAE23&serviceCode=10999995678&msisdn=%%i")

)


Curl命令可以通过命令行的方式,执行Http请求。在Elasticsearch中有使用的场景,因此这里研究下如何在windows下执行curl命令。


@echo off
del /q *.csv

::计算10分钟前的时间
set time_begin=%time:~0,8%

set /a hour=%time_begin:~0,2%
set /a minute=%time_begin:~3,2%
set second=%time_begin:~6,2%

if %minute% LSS 10 (
set /a minute=minute+50
set /a hour=hour-1
) else set /a minute=minute-10

if %hour% LSS 10 set hour=0%hour%
if %minute% LSS 10 set minute=0%minute%

set mtime=%date:~0,4%-%date:~5,2%-%date:~8,2% %hour%:%minute%:%second%

echo set echo off;>monitor.sql
echo set feedback off;>>monitor.sql
echo set trimspool on;>>monitor.sql
echo set trimout on;>>monitor.sql
echo set linesize 300;>>monitor.sql
echo set pagesize 2000;>>monitor.sql
echo set newpage 1;>>monitor.sql
echo set heading on;>>monitor.sql
echo set term off;>>monitor.sql
echo set termout off;>>monitor.sql
echo set timing off;>>monitor.sql

echo spool monitor.csv >>monitor.sql

echo SELECT '%mtime%' AS checktime,accountid, >>monitor.sql
echo (CASE WHEN tjl IS NULL THEN 0 ELSE tjl END) tjl >>monitor.sql
echo FROM (SELECT accountid,COUNT(*) tjl FROM T_SOURCEMSG%date:~2,2%%date:~5,2%%date:~8,2% >>monitor.sql
echo WHERE receivetime^>'%mtime%' GROUP BY accountid) t >>monitor.sql
echo RIGHT JOIN c_tjlfz r USING(accountid) WHERE tjl^<tjlfz OR tjl IS NULL; >>monitor.sql

echo spool off >>monitor.sql

echo exit>>monitor.sql
sqlplus src2018/"""src2018.i314"""@ywpt_172.30.9.153 @monitor.sql

type monitor.csv|find "20" >monitorend.csv

for /f "tokens=1-5 delims= " %%u in (monitorend.csv) do echo 【异网平台】10分钟接收量低于10,起始时间:%%v>E:\JYJ\newplatcontrol\accounttjl\tjl.csv

for /f "tokens=1-5 delims= " %%u in (monitorend.csv) do echo 账号:%%w,接收量:%%x>>E:\JYJ\newplatcontrol\accounttjl\tjl.csv

if not exist E:\JYJ\newplatcontrol\accounttjl\tjl.csv goto :end

for /f %%i in (mobile.txt) do (
curl -G --data-urlencode content@E:\JYJ\newplatcontrol\accounttjl\tjl.csv "http://172.30.9.151:9112/httpServer/http/sendSms?account=szap&reqNo=201707025105050001&authCode=CB989004546CB6C1EC45E8A858BCAE23&serviceCode=10999997766&msisdn=%%i")

:end

猜你喜欢

转载自blog.51cto.com/14143114/2335488