#!/bin/bash
#
# Init file for MDSD
#
# chkconfig: 2345 70 70
# description: Azure MDS daemon
#

### BEGIN INIT INFO
# Provides:             mdsd
# Required-Start:       $remote_fs
# Required-Stop:        $remote_fs
# Default-Start:        2 3 4 5
# Default-Stop:
# Short-Description:    Azure MDS daemon
### END INIT INFO

RETVAL=0
DESC="Azure MDS Daemon"
NAME=mdsd

MDSD_BIN=/usr/sbin/mdsd
MDSD_OPTIONS="-d"

# Exit if the package is not installed
[ -x "$MDSD_BIN" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

start()
{
    echo -n "Starting $DESC: "
    $MDSD_BIN $MDSD_OPTIONS
    RETVAL=$?
    echo
}

case "$1" in
    start)
        start
        ;;
    reload)
        # Not implemented. Keep for compatibility to ensure "systemctl reload <service>" does not fail
        ;;
    *)
        echo $"Usage: $0 {start|reload}"
        RETVAL=1
esac
exit $RETVAL