** Myself
#====================================================================
#
# MAIN PROGRAM: Operator Menu
#
# PURPOSE: Checks for system instances and
# startup/shutdown system instances
#
#====================================================================
#====================================================================
# Environment
#====================================================================
#
#
#
# oracle user ,Please change
orasid=dev
# sap user ,Please change
sapsid=dev
# SAP StartSRV MC Console Instant Name ,Please change ,for more instant add array
SAPINST[0]=DVEBMGS02
SAPINST[1]=ASCS00
SAPINST[2]=SCS01
#
#====================================================================
#====================================================================
# Main
#====================================================================
operation_menu=0
while [[ ! "x${operation_menu}x" = "x99x" ]] ; do
clear
echo "========================================"
echo "|--- Operation Menu (`hostname`) "
echo "========================================"
echo "(1) Start SAP"
echo "(2) Shutdown SAP"
echo "(99) Exit"
echo "Please select a number from the Operation Menu: "
read operation_menu
case ${operation_menu} in
1)
su - ora${orasid} -c "lsnrctl start"
su - ${sapsid}adm -c "startsap"
echo "SAP Startup"
echo "Please key to Main Menu: "
read
;;
2)
echo "Are you sure you want to Stop SAP ? [N/y]: "
read Answer
if [ "${Answer:="N"}" = "y" -o "${Answer:="N"}" = "Y" -o "${Answer:="N"}" = "yes" -o "${Answer:="N"}" = "Yes" ] ; then
su - ${sapsid}adm -c "stopsap"
su - ${sapsid}adm -c "saposcol -k"
i=0
while (( i < ${#SAPINST[*]} ))
do
su - ${sapsid}adm -c "stopsap sapstartsrv ${SAPINST[${i}]}"
echo "SAP Stop StartSRV MC Console"
echo "============================="
(( i = i + 1 ))
done
### For NW 7.1 Stop hostCTL by saphostexec -stop by enable below line
#/usr/sap/hostctrl/exe/saphostexec -stop
su - ora${orasid} -c "lsnrctl stop"
echo "SAP Stop"
echo "Press enter to continue: \c"
read waiting
elif [ "${Answer:="N"}" != "n" -a "${Answer:="N"}" != "N" -a "${Answer:="N"}" != "no" -a "${Answer:="N"}" != "No" ] ; then
echo "!!! Please choose Yes or No !!!"
sleep 1
fi
;;
99)
;;
*)
echo "!!! Please select a number from the list !!!"
sleep 1
;;
esac
done
#====================================================================
#
# MAIN PROGRAM: Operator Menu
#
# PURPOSE: Checks for system instances and
# startup/shutdown system instances
#
#====================================================================
#====================================================================
# Environment
#====================================================================
#
#
#
# oracle user ,Please change
orasid=dev
# sap user ,Please change
sapsid=dev
# SAP StartSRV MC Console Instant Name ,Please change ,for more instant add array
SAPINST[0]=DVEBMGS02
SAPINST[1]=ASCS00
SAPINST[2]=SCS01
#
#====================================================================
#====================================================================
# Main
#====================================================================
operation_menu=0
while [[ ! "x${operation_menu}x" = "x99x" ]] ; do
clear
echo "========================================"
echo "|--- Operation Menu (`hostname`) "
echo "========================================"
echo "(1) Start SAP"
echo "(2) Shutdown SAP"
echo "(99) Exit"
echo "Please select a number from the Operation Menu: "
read operation_menu
case ${operation_menu} in
1)
su - ora${orasid} -c "lsnrctl start"
su - ${sapsid}adm -c "startsap"
echo "SAP Startup"
echo "Please key to Main Menu: "
read
;;
2)
echo "Are you sure you want to Stop SAP ? [N/y]: "
read Answer
if [ "${Answer:="N"}" = "y" -o "${Answer:="N"}" = "Y" -o "${Answer:="N"}" = "yes" -o "${Answer:="N"}" = "Yes" ] ; then
su - ${sapsid}adm -c "stopsap"
su - ${sapsid}adm -c "saposcol -k"
i=0
while (( i < ${#SAPINST[*]} ))
do
su - ${sapsid}adm -c "stopsap sapstartsrv ${SAPINST[${i}]}"
echo "SAP Stop StartSRV MC Console"
echo "============================="
(( i = i + 1 ))
done
### For NW 7.1 Stop hostCTL by saphostexec -stop by enable below line
#/usr/sap/hostctrl/exe/saphostexec -stop
su - ora${orasid} -c "lsnrctl stop"
echo "SAP Stop"
echo "Press enter to continue: \c"
read waiting
elif [ "${Answer:="N"}" != "n" -a "${Answer:="N"}" != "N" -a "${Answer:="N"}" != "no" -a "${Answer:="N"}" != "No" ] ; then
echo "!!! Please choose Yes or No !!!"
sleep 1
fi
;;
99)
;;
*)
echo "!!! Please select a number from the list !!!"
sleep 1
;;
esac
done
0 comments:
Post a Comment