Thursday, August 18, 2016

How to invoke a shell script from a windows batch file

From  last few days I was  searching for a script that can invoke a shell script from windows batch file.After a prolonged search on google I made it. So thought of sharing here -

Create a text file with some name , for example Check_Service and save it as .bat. The content of my Check_Servic.bat is,

C:\Users\mahesh\Desktop\PT\putty.exe -ssh oracle@10.81.155.9 -pw Myoracle123 -m "C:\Users\mahesh\Desktop\PT\work3.txt" -t

And the content of  C:\Users\mahesh\Desktop\PT\work3.txt  is here ,


sh /home/oracle/mp/srvctl_status_db_DI.sh
/bin/bash 


And the content of my srvctl_status_db_DI.sh


for database in DIOES DIIAM DIHIM
do
export ORACLE_SID=${database}1
export ORAENV_ASK=NO
. oraenv >/dev/null 2>&1
srvctl status database -d $database
echo ------------------------------------------------------
done


Its a simple script to check the status of your cluster database . 

Double click the batch file -



No comments:

Post a Comment