#!/bin/ksh
export MW_HOME=/u01/app/oracle/Middleware
export INSTANCE_HOME=/u01/app/oracle/Middleware/asinst_1
## Script compatable with FMW11g OID on Linux EL5 ###
oidps1=`ps -ef | grep oidldapd | grep "inst=1" | grep -v grep | awk '{print $2}'`
oidps2=`ps -ef | grep oidldapd | grep "control" |grep -v grep | awk '{print $2}'`
oidld1=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep $oidps1 | awk '{print $7}'`
oidld2=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep $oidps2 | awk '{print $7}'`
oidmon=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep oidmon| awk '{print $7}'`
oidem=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep EMAGENT | awk '{print $7}'`
if [ "$oidld1" == "Alive" ] && [ "$oidld2" == "Alive" ] && [ "$oidmon" == "Alive" ] && [ "$oidem" == "Alive" ];
then
echo "OID running"
echo "OID ldap Services are running " > /u01/app/oracle/ldap_scripts/ldap_running.txt
date >> /u01/app/oracle/ldap_scripts/ldap_running.txt
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status >> /u01/app/oracle/ldap_scripts/ldap_running.txt
mailx -s "OID processes are running on OID Server" test@test.com < /u01/app/oracle/ldap_scripts/ldap_running.txt
else
echo "failed"
mailx -s "OID processes are not running on OID Server" test@test.com < /u01/app/oracle/ldap_scripts/ldap_start_stop_process.txt
fi
====== ldap_start_stop_process.txt == File output ========
#######################################################################################
LDAP OID Services stop / Start procedure
#######################################################################################
INSTANCE_HOME=/u01/app/oracle/Middleware/asinst_1/bin/
MW_HOME=/u01/app/oracle/Middleware/
### LDAP Services Status Check ###
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status
### LDAP Services Stop all services ###
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl stopall
### LDAP Services Start all services ###
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl startall
===== Script End opmnctl status sample output ==============
oidsrv1$
oidsrv1$ /u01/app/oracle/Middleware/asinst_1/bin/opmnctl status
Processes in Instance: asinst_1
---------------------------------+--------------------+---------+---------
ias-component | process-type | pid | status
---------------------------------+--------------------+---------+---------
oid1 | oidldapd | 4962 | Alive
oid1 | oidldapd | 4953 | Alive
oid1 | oidmon | 4914 | Alive
EMAGENT | EMAGENT | 4912 | Alive
oidsrv1$
export MW_HOME=/u01/app/oracle/Middleware
export INSTANCE_HOME=/u01/app/oracle/Middleware/asinst_1
## Script compatable with FMW11g OID on Linux EL5 ###
oidps1=`ps -ef | grep oidldapd | grep "inst=1" | grep -v grep | awk '{print $2}'`
oidps2=`ps -ef | grep oidldapd | grep "control" |grep -v grep | awk '{print $2}'`
oidld1=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep $oidps1 | awk '{print $7}'`
oidld2=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep $oidps2 | awk '{print $7}'`
oidmon=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep oidmon| awk '{print $7}'`
oidem=`/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status | grep EMAGENT | awk '{print $7}'`
if [ "$oidld1" == "Alive" ] && [ "$oidld2" == "Alive" ] && [ "$oidmon" == "Alive" ] && [ "$oidem" == "Alive" ];
then
echo "OID running"
echo "OID ldap Services are running " > /u01/app/oracle/ldap_scripts/ldap_running.txt
date >> /u01/app/oracle/ldap_scripts/ldap_running.txt
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status >> /u01/app/oracle/ldap_scripts/ldap_running.txt
mailx -s "OID processes are running on OID Server" test@test.com < /u01/app/oracle/ldap_scripts/ldap_running.txt
else
echo "failed"
mailx -s "OID processes are not running on OID Server" test@test.com < /u01/app/oracle/ldap_scripts/ldap_start_stop_process.txt
fi
====== ldap_start_stop_process.txt == File output ========
#######################################################################################
LDAP OID Services stop / Start procedure
#######################################################################################
INSTANCE_HOME=/u01/app/oracle/Middleware/asinst_1/bin/
MW_HOME=/u01/app/oracle/Middleware/
### LDAP Services Status Check ###
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl status
### LDAP Services Stop all services ###
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl stopall
### LDAP Services Start all services ###
/u01/app/oracle/Middleware/asinst_1/bin/opmnctl startall
===== Script End opmnctl status sample output ==============
oidsrv1$
oidsrv1$ /u01/app/oracle/Middleware/asinst_1/bin/opmnctl status
Processes in Instance: asinst_1
---------------------------------+--------------------+---------+---------
ias-component | process-type | pid | status
---------------------------------+--------------------+---------+---------
oid1 | oidldapd | 4962 | Alive
oid1 | oidldapd | 4953 | Alive
oid1 | oidmon | 4914 | Alive
EMAGENT | EMAGENT | 4912 | Alive
oidsrv1$