Last active
October 17, 2022 22:32
-
-
Save chb0github/c8af7c1559d818af3e90a39519bb33b7 to your computer and use it in GitHub Desktop.
a jiggler bash scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
set -o pipefail | |
function jiggle() { | |
local bearer="${1:?You must supply a bearer token}" | |
local delay="${2:?You must supply a randomized delay upper bound}" | |
local urls=( | |
# add urls here to randomly select from | |
"https://confluence.wrs.com/pages/viewpage.action?pageId=78809531" | |
"https://stackoverflow.com/questions/2388488/how-to-select-a-random-item-from-an-array-in-shell" | |
"https://confluence.wrs.com/display/~pbahrs/Improved+content+installation+and+update" | |
) | |
while true ; do | |
local url=${urls[ $RANDOM % ${#urls[@]} ]} | |
local d=$(( "$RANDOM" % "${delay}" + 1)) | |
echo "$(date -u)|${delay}|${url}" | |
sleep ${d}; | |
curl -sL -H "Accept: */*" -H "Authorization: Bearer ${bearer}" "${url}" > /dev/null; | |
done | |
} | |
jiggle "$1" "${2:-200}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment