I'm new to scripting languages and I want to to ask simple question.
#!/usr/bin/perl
my $process_id = shift;
execute();
sub execute() {
system("cd", "bin");
my $output = `pcp.sh -p $process_id`;
if (index($output, "some string") != -1) {
print("Information 1.0 :Standalone server works fine \n");
}
else {
print("Information 2.0 Standalone server have some problems)\n");
}
}
for 'pcp.sh' follow the link :
http://www.oracle.com/technetwork/systems/security/pcp-149863.txt
This script works on terminal and returns
Information 1.0 Standalone server works fine
But I'm doing script monitoring and monitoring tool gets the output as return value. (It is very strange.) On monitoring tool while I'm running the script it says
Information 2.0 Standalone server have some problems
I need to get output from pcp.sh
. And this pcp.sh -p $process_id
part of that code is running for about one minute. The monitoring tool runs for maybe five seconds. I undrstand that I have to wait, but I don't know how to handle this job.