22 lines
468 B
Bash
22 lines
468 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -o nounset
|
||
|
set -o pipefail
|
||
|
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
|
||
|
|
||
|
RATE_CHANGE_FACTOR=$1
|
||
|
IFS=" " read -r -a OPTS <<< $2
|
||
|
URL=${OPTS[0]}; METHOD=${OPTS[1]}; RATE=${OPTS[2]}; BODY=${OPTS[3]}
|
||
|
SLEEP_TIME=$(expr 60 / $RATE / $RATE_CHANGE_FACTOR)
|
||
|
|
||
|
until false
|
||
|
do
|
||
|
curl --header "Content-Type: application/json" \
|
||
|
--data $BODY \
|
||
|
-X $METHOD \
|
||
|
-s $URL \
|
||
|
-o /dev/null
|
||
|
printf '%s' "."
|
||
|
sleep $SLEEP_TIME
|
||
|
done
|