#! /bin/bash
#*****************************************************************************
# Copyright 2004-2006 NetApp, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation,  version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#*****************************************************************************
# mpp     start device discovery 
#
# chkconfig: 35 14 91
# description: NetApp E-Series MPP driver, Dynamic Device Discovery script during bootup.
# processname: mpp
#
#  %version:            3 %
#  %created_by:         somasunk %
#  %date_created:       Wed Dec 14 17:16:03 2011 %


PATH=/bin:/sbin:/usr/bin:/usr/sbin

if [ -f /etc/init.d/functions ]; then
    . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
    . /etc/rc.d/init.d/functions
else
    exit 0
fi

test -f  || exit 0

function start()
{
    if [ -d /proc/iba ]; then

            if [ -f /usr/sbin/hot_add ] ; then
#               sleep 10
                touch /var/lock/subsys/mpp
                date > /var/lock/subsys/mpp
                /usr/sbin/hot_add >> /var/lock/subsys/mpp
            fi
    fi

}

function stop()
{
    if [ -f /var/lock/subsys/mpp ] ; then
        rm -f /var/lock/subsys/mpp
    fi
}

function restart()
{
    stop
    start
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        restart
        ;;
    *)
       echo $"Usage: $0 {start|stop|restart}"
       exit 1
esac

exit 0


