#!/bin/sh
#
# ###################################################################
# Copyright (c) 2005-2011, EMC Corporation. All Rights Reserved.
#
# /etc/init.d/PowerMig
# This file is a part of EMC PowerPath.
#
# chkconfig: 35 99 99
# description: Runs PowerPath Migration Enabler recovery, if
#              required on bootup.
#
# ###################################################################
#
### BEGIN INIT INFO
# Provides:          PowerMig
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 5 S
# Default-Stop:      6
# Description:       PowerMig -- Runs PowerPath Migration Enabler recovery, if
#                    required on bootup.
### END INIT INFO


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

case "$1" in
    start)
        cat /etc/issue | grep "Red Hat"  > /dev/null
        if [ $? -eq 0 ]; then
            touch /var/lock/subsys/PowerMig
        fi

        /sbin/powermig recover -all -no > /dev/null 2>&1
        /sbin/powermig info -all -query > /dev/null 2>&1
        /sbin/powermig options -startupInProgress 0 > /dev/null 2>&1
        ;;

    stop)
        /sbin/powermig transition -no > /dev/null 2>&1
        ;;
    *)
        ;;
esac

