Loading ...
Sorry, an error occurred while loading the content.
 

Print process id

Expand Messages
  • Vema Venkata
    I have a following script to print the process id to a log file but in the log file the poroccess id seems to be different can any one help/sugges
    Message 1 of 3 , Sep 2 5:24 AM
      I have a following script to print the process id to a log file
      but in the log file the poroccess id seems to be different
      can any one help/sugges





      #!/proj/ahd02/CAisd/ActivePerl-5.6.0.618/bin/perl -w
      #/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";
      $ret = qx(pgrep -f srvtst26);
      if ($? eq 0){
      $ret = qx(pgrep - f $xapipgm);
      print "AHD XAPI SERver Running with Process ID :$$ On '$now_string'";
      } else{
      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 '$now_string'";
      close F;
      $ret =qx(perl $xapipgm >>/proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log);
      }




      [Non-text portions of this message have been removed]
    • Damien Carbery
      ... /proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log )||die OS Error was $! n ; ... Woah, be patient. I think the majority of members of this
      Message 2 of 3 , Sep 2 5:37 AM
        --- In perl-beginner@yahoogroups.com, "Vema Venkata" <venkatsb@a...>
        wrote:
        >
        >
        > I have a following script to print the process id to a log file
        > but in the log file the poroccess id seems to be different
        > can any one help/sugges
        >
        >
        >
        >
        >
        > #!/proj/ahd02/CAisd/ActivePerl-5.6.0.618/bin/perl -w
        > #/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";
        > $ret = qx(pgrep -f srvtst26);
        > if ($? eq 0){
        > $ret = qx(pgrep - f $xapipgm);
        > print "AHD XAPI SERver Running with Process ID :$$ On '$now_string'";
        > } else{
        > 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 '$now_string'";
        > close F;
        > $ret =qx(perl $xapipgm
        >>/proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log);
        > }
        >

        Woah, be patient. I think the majority of members of this list are
        based in the US you may have to wait more than 3 hours for a response.

        As there are no comments in the script I'm not sure what you are
        trying to do. One thing comes to mind: If you run a process, it
        completes and you run it again, the process IDs will be different.
        This probably doesn't help you but since you seem anxious for a
        response this should keep you going until others respond.
      Your message has been successfully submitted and would be delivered to recipients shortly.