you can also look inside  /proc although the data in there is mostly binary.
PS just parses your proc directory. read up on PROCFS

Mark

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "zentara" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, December 13, 2002 1:48 PM
Subject: Re: obtaining a process ID.


>
> Thanks all for the suggestions.
>
> Looks like I'm stuck using the ps command.  I'm writing this script on an
> appliance system with very limited perl modules loaded (can't load more
> because it needs to work on the appliance as it is shipped).
>
> I appreciate the feedback.
>
> -gomes
>
>
> On Thu, 12 Dec 2002 12:09:02 -0500 zentara <[EMAIL PROTECTED]> wrote:
>
> > On Wed, 11 Dec 2002 18:38:31 -0500,
> > [EMAIL PROTECTED] (B-E-G
> > Gomes) wrote:
> >
> > >
> > >Looking for a simple method of getting a
> > single process ID (for a
> > >process such as syslogd) and store it in a
> > scalar.
> > >
> > >I've found a few methods of doing so but they
> > haven't been pretty.
> > >
> > >I'm taking suggestions :)
> > ##################################################
> > #!/usr/bin/perl -w
> > use strict;
> > use Proc::ProcessTable;
> >
> > my $t1 = new Proc::ProcessTable;
> > my $pid;
> > my $commandline = shift || $0;
> > foreach my $p (@{$t1->table}){
> >    if($p->cmndline =~ /\Q$commandline\E/){
> >         $pid = $p->pid;
> >         print "$pid\n";
> >      }
> > }
> > ###################################################
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to