#!/bin/sh -e

APP="sysmond"

case "$1" in
    configure)
        if [ -x /bin/systemctl -a -f /etc/systemd/system/yandex-solomon-${APP}.service ] ; then
            if ! /bin/systemctl enable yandex-solomon-${APP} ; then
                echo "Cannot enable ${APP} service!"
            fi
            if ! /bin/systemctl restart yandex-solomon-${APP} ; then
                echo "Cannot restart ${APP} service!"
            fi
        elif [ -x /usr/bin/service -a -f /etc/init/yandex-solomon-${APP}.conf ] ; then
            if ! /usr/bin/service yandex-solomon-${APP} restart ; then
                echo "Cannot restart ${APP} service!"
            fi
        fi
        ;;
    *)
        ;;
esac
