Hi, I'm trying to call an Oracle database utility within a perl script. Initially, I created the perl script to check some background process on the server. Now, if certain processes exist, I want to launch this database utility. I need help in executing/launching within this script. So far my code works, but I am stuck in launching oracle export utility. Basically, I check for certain conditions, if both are true (1), run oracle utility. For testing, the third condition is set (0,1) where one of the nodes is down, but what happens is the exp utility executes and it shouldn't. It should only execute under first condition, (both ==1). Can someone help? Thank you.
============================================================
my $checkrpc1= `ps -ef|grep rpc.statd |grep -v grep|wc -l`;
my $checkrpc2= `ssh node2 ps -ef|grep rpc.statd |grep -v grep|wc -l`;
# Running datapump
my $expdp=`/home/oracle/product/11.1.0.6.0/bin/expdp parfile=/home/oracle/param/TST.par`;
if (($checkrpc1 == 1) && ($checkrpc2 == 1)) {
print qq (\nBoth NFS rpc daemons are UP. $date);
send_email("Both NFS rpc daemons are UP. $date");
#$expdp; ##Stuck here..
} elsif (($checkrpc1 == 1) && ($checkrpc2 == 0)) {
print qq (\nNFS rpc daemon on node 2 is down. $date);
send_email("NFS rpc daemon on node 2 is down. $date");
} elsif (($checkrpc1 == 0) && ($checkrpc2 == 1)) {
print qq (\nNFS rpc daemon on node 1 is down. $date);
send_email("NFS rpc daemon on node 1 is down. $date");
} elsif (($checkrpc1 == 0) && ($checkrpc2 == 0)) {
print qq (\nBoth NFS rpc daemons are down. $date);
send_email("Both NFS rpc daemons are down. $date");
} else {
print qq (\nError in status of rpc daemon.Check it out. $date);
send_email("Error in status of rpc daemon.Check it out. $date");
}
============================================================
my $checkrpc1= `ps -ef|grep rpc.statd |grep -v grep|wc -l`;
my $checkrpc2= `ssh node2 ps -ef|grep rpc.statd |grep -v grep|wc -l`;
# Running datapump
my $expdp=`/home/oracle/product/11.1.0.6.0/bin/expdp parfile=/home/oracle/param/TST.par`;
if (($checkrpc1 == 1) && ($checkrpc2 == 1)) {
print qq (\nBoth NFS rpc daemons are UP. $date);
send_email("Both NFS rpc daemons are UP. $date");
#$expdp; ##Stuck here..
} elsif (($checkrpc1 == 1) && ($checkrpc2 == 0)) {
print qq (\nNFS rpc daemon on node 2 is down. $date);
send_email("NFS rpc daemon on node 2 is down. $date");
} elsif (($checkrpc1 == 0) && ($checkrpc2 == 1)) {
print qq (\nNFS rpc daemon on node 1 is down. $date);
send_email("NFS rpc daemon on node 1 is down. $date");
} elsif (($checkrpc1 == 0) && ($checkrpc2 == 0)) {
print qq (\nBoth NFS rpc daemons are down. $date);
send_email("Both NFS rpc daemons are down. $date");
} else {
print qq (\nError in status of rpc daemon.Check it out. $date);
send_email("Error in status of rpc daemon.Check it out. $date");
}