#!/usr/bin/env sh
set -eu

USAGE='Usage:\nrunit-disable-service SERVICE_NAME';
SERVICE_ENABLED_DIR=/service

if [ "$#" = 0 ]
then
    echo -e ${USAGE}
    exit 1
fi

SERVICE_NAME=${1};

if [ ! -L "$SERVICE_ENABLED_DIR/$SERVICE_NAME" ]
then
    echo "Service \"$SERVICE_ENABLED_DIR/$SERVICE_NAME\" hasn't enabled."
    exit 2
fi

rm ${SERVICE_ENABLED_DIR}/${SERVICE_NAME}