#!/bin/sh
# DocuSeal-Healthcheck (elm-energy, 2026-10-14): Web erreichbar UND Sidekiq-Herzschlag in Redis.
wget -q --spider http://127.0.0.1:3000/ || exit 1
REDISCLI_AUTH=$(printf 'redis%s' "$SECRET_KEY_BASE" | sha1sum | cut -d' ' -f1)
export REDISCLI_AUTH
for p in $(redis-cli -h 127.0.0.1 -p 16379 --raw smembers processes 2>/dev/null); do
  [ "$(redis-cli -h 127.0.0.1 -p 16379 --raw exists "$p" 2>/dev/null)" = "1" ] && exit 0
done
exit 1
