#!/bin/bash
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"

. $DIR/bash/_docker-cmd.sh || {
  echo "no docker cmd is presented" && exit 1
}

PYTHON_SERVICE=$1

if [[ -z "${PYTHON_SERVICE}" ]]; then
  echo "Usage: $(basename $0) PYTHON_PROJECT_NAME"
  exit 1
fi

CONTAINER=$(docker ps | grep "python-${PYTHON_SERVICE}" | awk '{print $1}')

if [[ -z "${CONTAINER}" ]]; then
  echo "Unable to find container: db"
  exit 1
fi

$DOCKER_CMD restart ${CONTAINER}