From bd7891d2fb3e5044d182ad1095a0ebc95a9606e0 Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 20 Aug 2022 12:43:27 +0200 Subject: [PATCH] util to move counter up/down --- utils/movecounter.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 utils/movecounter.sh diff --git a/utils/movecounter.sh b/utils/movecounter.sh new file mode 100755 index 0000000..c094ce8 --- /dev/null +++ b/utils/movecounter.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -eu + +queue_num="${QUEUE_NUM:-0}" +user_password="${USER_PASSWORD}" +host="${HOST:-http://localhost:8000}" + + + +if [ "$1" = "+1" ]; then + url="${host}/v1/counter/${queue_num}/increment" +else + url="${host}/v1/counter/${queue_num}/decrement" +fi + +curl -s -X POST -u "${user_password}" "${url}"