我对bash脚本比较陌生,因此如果这是一个愚蠢的问题,请原谅我。这是我简单的bash脚本。编写它是为了将POST请求重复发送到REST API。我设置了一些警报,当我达到这些消息的特定阈值时将触发这些警报。
for i in {0..600};
do
curl -X POST -d '{"rsID":{"action":"RECORDING_REQUESTED","ccid":"9999","rsId":"1c047ce2-8870-3072-852c-deae92a89105","chnnlId":"7438caaf-69bd-d76e-8091-3e5f60e57ad7","canonId":"1bb750d2-7b2a-2792-e21b-cdd8e41e6540","srsId":"","xtId":"SH009513260000","schDurSec":"1800","schStrtMillisecs":1539287671000,"schEndMillisecs":1539289471000,"count":40000}' -H "Content-Type:application/json" http://random-site/api/v1/proxy/folders/dvr-scheduler/services/https:dispatch-1-0-5:443/service/addSchedulerEvent;
echo sent query $i;
sleep 1;
done
我每次都会在终端中收到此错误
Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@24077193; line: 1, column: 1])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@24077193; line: 1, column: 663]sent query 0
Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@44d2b5af; line: 1, column: 1])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@44d2b5af; line: 1, column: 663]sent query 1
Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@f2b601e; line: 1, column: 1])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@f2b601e; line: 1, column: 663]sent query 2
有人知道我在做什么错吗?
编辑:请注意schDurSec是一个字符串,而schStrtMillisecs,schEndMillisecs和count是整数。
答案 0 :(得分:1)
数据中缺少右花括号:
'{"rsID":
{"action":"RECORDING_REQUESTED",
"ccid":"9999",
"rsId":"1c047ce2-8870-3072-852c-deae92a89105",
"chnnlId":"7438caaf-69bd-d76e-8091-3e5f60e57ad7",
"canonId":"1bb750d2-7b2a-2792-e21b-cdd8e41e6540",
"srsId":"",
"xtId":"SH009513260000",
"schDurSec":"1800",
"schStrtMillisecs":1539287671000,
"schEndMillisecs":1539289471000,
"count":40000
}
}' # <-- this brace is missing