[PLUG] Extracting the pid - Resolved

Richard Steffens rsteff at attbi.com
Tue May 21 18:33:51 UTC 2002


"Randy.Dunlap" wrote:

> I use
>   pid=`ps -C $target -o pid=`
> to get PID of $target in a bash script.

So, if I put:

exec(ps -C mpg123 -o pid=)

in my php it works.

Richard F Seymour wrote:

> ps ax | grep mpg123 | awk '{print $1}'
> 
> or to exclude the grep line itself:
> 
> ps ax | grep [m]pg123 | awk '{print $1}'

Both of these work, too.

Paul Heinlein wrote:
 
> pidof mpg123

As does this. This one seems the cleanest, too. As with many things in
Linux, there is often more than one way to get something done.

Thanks to all.

-- 
Regards,

Dick Steffens
"Quando Omni Flunkus Moritati"
http://rsteff.home.attbi.com/




More information about the PLUG mailing list