Re: Find existence of a proc
From: Dan Mercer (dmercer_at_mn.rr.com)
Date: 07/06/03
- Next message: Heiner Steven: "Re: Call for input on comp.unix.shell FAQ"
- Previous message: Juergen Heck: "Re: Find existence of a proc"
- In reply to: Juha Laiho: "Re: Find existence of a proc"
- Next in thread: Juergen Heck: "Re: Find existence of a proc"
- Reply: Juergen Heck: "Re: Find existence of a proc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 6 Jul 2003 12:46:26 -0500
"Juha Laiho" <Juha.Laiho@iki.fi> wrote in message news:be8q34$itp$2@ichaos.ichaos-int...
: "DL" <dl@internet.net> said:
: >I want to find out if a process is running on the system in a script by
: >"ps -ef | grep procname", but don't know how to test it, can some one show
: >me a piece of code?
:
: Others have already responded on how to test the result of "ps | grep",
: so nothing more on that.
:
: But something on the use of "ps": depending on your platform, you may be
: able to avoid some false positives by having "ps" just list the column
: you need:
: "ps -eo comm="
: ... and, if you know which account should be running that command,
: "ps -u acct -o comm="
:
: (the trailing "=" after the column name prevents display of the column
: header)
:
: On Linux this works by itself; on Solaris you need to use the
: /usr/xpg4/bin/ps . Don't know about the other variants (HP-UX, AIX, ...).
On HP-UX you must set UNIX95 (even to null works) to get xpg4 behavior.
Both HP-UX and Linux ps's support the -C option.
Linux:
ps -C httpd -o pid
on HP-UX
UNIX95= ps -C httpd -o pid
Dan Mercer
dmercer@mn.rr.com
: --
: Wolf a.k.a. Juha Laiho Espoo, Finland
: (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
: PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
: "...cancel my subscription to the resurrection!" (Jim Morrison)
- Next message: Heiner Steven: "Re: Call for input on comp.unix.shell FAQ"
- Previous message: Juergen Heck: "Re: Find existence of a proc"
- In reply to: Juha Laiho: "Re: Find existence of a proc"
- Next in thread: Juergen Heck: "Re: Find existence of a proc"
- Reply: Juergen Heck: "Re: Find existence of a proc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|