#!/bin/sh -e

SOLOMON_ROOT="/Berkanavt/solomon"

APP="ingestor"
APP_ROOT="${SOLOMON_ROOT}/${APP}"

USER="user_${APP}"
GROUP="group_solomon"

case "$1" in
    configure)
        /bin/chown ${USER}:${GROUP} ${APP_ROOT}

        /bin/systemctl stop yandex-solomon-${APP} || true

        if ! /bin/systemctl start yandex-solomon-${APP};  then
            echo "Cannot start ${APP} service"
        fi
        ;;

esac
