#!/proj/ahd02/CAisd/ActivePerl-5.6.0.618/bin/perl
#/usr/local/bin/perl

use POSIX qw(strftime);

$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;  

$xapipgm = "/proj/ahd02/CAisd/site/mods/scripts/srvtst26.pl";

$pid = qx(pgrep -f srvtst26);

if ($pid =! 0){
  print "AHD XAPI SERver Running with Process ID '$pid' On $now_string\n" ;
}  
else{
  $pid = `ps-f|grep $srvtst26`;
  print "Server Started : $pid \n"; 
  open (F, ">> /proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log") || die 
"OS Error was $! \n";
  print F "AHDXAPI Server is now started running '$pid' $now_string";
  close F;
}

In the above pgm
$pid = qx(pgrep -f srvtst26); #here it check if the process is running say if it is 
running it writes to a log file


else
$pid = `ps-f|grep $srvtst26`;
here in the above command it has to grep the process id and return to a variable $pid 
and write it to a log file






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to