- update ui - implement different features like restart - bugfixes Co-authored-by: pstruebi <struebin.patrick.com> Reviewed-on: https://gitea.pstruebi.xyz/auracaster/bumble-auracast/pulls/8
26 lines
708 B
Bash
26 lines
708 B
Bash
#!/usr/bin/env bash
|
|
# Usage: ./hit_status.sh [COUNT] [SLEEP_SECONDS]
|
|
# Always targets http://127.0.0.1:5000/status
|
|
# Defaults: COUNT=100 SLEEP_SECONDS=0
|
|
# Example: ./hit_status.sh 100 0.05
|
|
|
|
set -euo pipefail
|
|
|
|
URL="http://127.0.0.1:5000/status"
|
|
COUNT="${1:-100}"
|
|
SLEEP_SECS="${2:-0}"
|
|
|
|
# Ensure COUNT is an integer
|
|
if ! [[ "$COUNT" =~ ^[0-9]+$ ]]; then
|
|
echo "COUNT must be an integer, got: $COUNT" >&2
|
|
exit 1
|
|
fi
|
|
|
|
for i in $(seq 1 "$COUNT"); do
|
|
echo "[$i/$COUNT] GET $URL"
|
|
curl -sS "$URL" > /dev/null || echo "Request $i failed"
|
|
# Sleep if non-zero (supports floats, no bc needed)
|
|
if [[ "$SLEEP_SECS" != "0" && "$SLEEP_SECS" != "0.0" && "$SLEEP_SECS" != "" ]]; then
|
|
sleep "$SLEEP_SECS"
|
|
fi
|
|
done |