#
# PROPRIETARY/CONFIDENTIAL. Use of this product is subject to
# license terms. Copyright C 2001-2003 Sun Microsystems, Inc.
# All rights reserved.
#

begincount=3
counter=$begincount

if "${ROOT_INSTANCE}/status-dps" > /dev/null 2>&1 ; then
   msg="restarted"
else
   msg="started"
fi 


while ${DPS_TEST} 0 -lt $counter ; do
    if ${DPS_TEST} $counter -lt $begincount ; then
       ${DPS_ECHO} "Retrying restart-dps for ${INSTANCE}."
    fi
    counter=`${DPS_EXPR} $counter - 1`
    if "${ROOT_INSTANCE}/stop-dps" ; then
       "${ROOT_INSTANCE}/start-dps" $@
       if "${ROOT_INSTANCE}/status-dps" > /dev/null 2>&1 ; then
          ${DPS_ECHO} "The DPS process for ${INSTANCE} has been $msg."
          exit 0
       fi
    fi
done

${DPS_ECHO} "The DPS process (ldapfwd) for ${INSTANCE} would not stop."

exit 1
