#!/bin/sh -e

SVC="bind-exporter"

case "$1" in
    configure)
        if [ -x /bin/systemctl -a -f /etc/systemd/system/${SVC}.service ] ; then
            /bin/systemctl stop ${SVC} || true
            /bin/systemctl daemon-reload

            if ! /bin/systemctl enable ${SVC} ; then
                echo "Cannot enable ${SVC} service!"
            fi
            if ! /bin/systemctl restart ${SVC} ; then
                echo "Cannot restart ${SVC} service!"
            fi
        fi
        ;;
    *)
        ;;
esac
