#!/bin/bash

#set -x 
export PATH=/bin:/usr/bin:$PATH

OP_MODE=$1
case $OP_MODE in
--help )
   echo "Usage: resetsysconn {--reset|--cancel|--help}"
   echo "    --reset    It will reset all connections of the managed systems"
   echo "               after reboot the Hardware Management Console."
   echo "    --cancel   cancel the reset operation before the reboot"
   echo "    --help     show this help page"
   ;;
--reset )
   echo " resetsysconn will reset the leasing addresses."
   echo " are you going to continue? [yes/no]"
   read ANSWER
   if [ "$ANSWER" = "yes" ]; then
      touch /var/hsc/tmp/.resetSysConn 
      echo " Please reboot the Hardware Management Console."
   else
      exit 2
   fi
   ;;
--cancel )
   echo " resetsysconn will cancel the reset leasing address operation."
   echo " are you going to continue? [yes/no]"
   read ANSWER
   if [ "$ANSWER" = "yes" ]; then
      rm -f /var/hsc/tmp/.resetSysConn
      echo " resetsysconn has bee cancelled."
   else
      exit 2
   fi
   ;;
*)
   echo " Usage: resetsysconn {--reset|--cancel|--help}"
   exit 1
esac

