#!/bin/ksh
#  ALTRAN_PROLOG_BEGIN_TAG                                                    
#  This is an automatically generated prolog.                                  
#                                                                              
#  Copyright (C) Altran ACT S.A.S. 2018,2021.  All rights reserved.  
#                                                                              
#  ALTRAN_PROLOG_END_TAG                                                      
#                                                                              
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61pkgha_r714 src/packages/cluster/es/server/utils/usr/cluster.es.server.utils.unconfig.sh 1.8.1.1 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1997,2011 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)  7d4c34b packages/cluster/es/server/utils/usr/cluster.es.server.utils.unconfig.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM
#

###############################################################################
#
#  Name:  onintr
#
#  Rudimentary signal handler
#
#  Arguments:    none
#  Returns:      5 - exit with error
#  Environment:  interrupt handler
#
###############################################################################
onintr()
{
    echo "$0: Caught signal - exiting"
    exit 5
}

###############################################################################
#
#  Name:  if_failed
#
#  Common exit method
#
#  Arguments:    status - return code from some operation
#                errmsg - error message to display (if operation failed)
#
#  Returns:      if status is non 0 exit with error
#  Environment:  installp
#
###############################################################################
if_failed()
{
    status=$1
    errmsg=$2
    if [ $status -ne 0 ]; then
        echo "Failed $errmsg"
        exit $status
    fi
}

###############################################################################
#
# Main
#
###############################################################################

#
# Setup a rudimentary PATH
#
PATH=$PATH:/bin:/usr/bin:/usr/sbin

#
# Establish a signal handler
#
trap onintr 1 2 3 15

##################### Begin old crontab information removal ##################
# The INUCLIENTS and INUBOSTYPE variables are set if installed within a NIM environment. So we
# cannot do crontab modifications if users install to NIM SPOTS.
if [ ! "$INUCLIENTS" -a ! "$INUBOSTYPE" ]; then
   CRONTMP=/usr/tmp/crontmp$$
   CRONFILE=/var/spool/cron/crontabs/root
   # First remove clcycle entry if it already exists.
   ed - $CRONFILE << EOF >/dev/null 2>&1
g/clcycle/d
g/cllvm/d
w
q
EOF
fi
#####################  End old crontab information removal  ##################

######## Remove temporary file ########

rm -f /usr/es/sbin/cluster/etc/config/haver.info

######## End remove temporary file ######## 

exit 0
