Skip to content

Reset users

Redis User Creation Scriptยถ

create_users.sh
#!/usr/bin/env bash
# CONFIG
HOST=clustercfg.ub-elasticache-rg.bazj4a.ilc1.cache.amazonaws.com
START=1
END=30000              # or 250000
PROVIDER="cellcom"
SALT="Q3dB6dCRGC"

# record start timestamp
start_ts=$(date +%s)
for i in $(seq "$START" "$END"); do
  input="${i}/${PROVIDER}/${SALT}"
  # Get SHA3-256 hex directly from openssl
    key="$(echo -n "$input" | openssl dgst -sha3-256 -r | awk '{print toupper($1)}')"
  redis6-cli -c -h "$HOST" HSET "$key" "serverCtr" "00000000" "appletCtr" "00000000"  >/dev/null
done

# calculate runtime
end_ts=$(date +%s)
runtime=$(( end_ts - start_ts ))


echo "Done: updated $((END-START+1)) hashes in ${runtime}s"