#!/bin/sh
source /etc/karoo.conf.d/config/redis-connect-info
DB="5"
REDIS_CMD="redis-cli -a ${REDIS_PASS} -h ${REDIS_HOST} -p ${REDIS_PORT} -n ${DB}"

if [ -z "$1" ]; then
    echo "Usage:  sbc-user-del user@domain.local"
    exit 1
fi

if ${REDIS_CMD}  DEL $1 > /dev/null; then
    echo "User $1 account deleted"
    exit 0
else
    echo "Is Karoo and Redis running?"
    exit 1
fi