Re: [Nolug] Bash backup script help

From: Dustin Puryear <dustin_at_puryear-it.com>
Date: Mon, 09 Jul 2007 15:40:08 -0500
Message-ID: <46929D28.9050706@puryear-it.com>

There is also:

$ ps -C <name-of-exe>

I'm not sure how portable this is however. In scripts, I use the 'grep
-v grep | grep <name-of-exe>' approach usually as well.

--
Puryear IT, LLC
Identity Management, Directory Services, Systems Integration
Baton Rouge, LA * 225-706-8414 * http://www.puryear-it.com
"Best Practices for Managing Linux and UNIX Servers"
  http://www.puryear-it.com/pubs/ebooks/linux-unix-best-practices
-ray wrote:
> On Sat, 23 Jun 2007, B. Estrade wrote:
> 
>> if [ -n `ps -auxw | grep name_of_exe`  ]; then
> 
> Be careful with this, as the "grep name_of_exe" will also show up in the
> ps output, so this statement would always be true.  You need to exclude
> "grep" from ps output:
> 
>> if [ -n `ps -auxw | grep -v grep | grep name_of_exe`  ]; then
> 
> Someone also mentioned pgrep.  Redhat/Fedora also has /sbin/pidof. 
> pgrep is probably more standard though (at least on Linux/Solaris).
> 
> ray
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/09/07

This archive was generated by hypermail 2.2.0 : 12/19/08 EST