ps -ef


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ps -ef
Prev   Next
# 1  
Old 06-16-2006
ps -ef

Hi

In a script we are checking if any other instance of the same script is running to make sure that we don't run multiple threads, and if there is only one then we are proceeding otherwise coming out of it ..
To do this we check as below,
ps -ef | grep -i 'scriptname' | grep -v grep | wc -l

this at times returns 2, but when I try to display
ps -ef | grep -i 'scriptname' | grep -v grep

it shows only the current instance that is getting started ..
Can anyone please help me in figuring out the problem.

Many thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question
XZGREP(1)							     XZ Utils								 XZGREP(1)

NAME
xzgrep - search compressed files for a regular expression SYNOPSIS
xzgrep [grep_options] [-e] pattern file... xzegrep ... xzfgrep ... lzgrep ... lzegrep ... lzfgrep ... DESCRIPTION
xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed directly to grep(1). If no file is specified, then the standard input is decompressed if necessary and fed to grep(1). When reading from standard input, gzip(1) and bzip2(1) compressed files are not supported. If xzgrep is invoked as xzegrep or xzfgrep then egrep(1) or fgrep(1) is used instead of grep(1). The same applies to names lzgrep, lze- grep, and lzfgrep, which are provided for backward compatibility with LZMA Utils. ENVIRONMENT
GREP If the GREP environment variable is set, xzgrep uses it instead of grep(1), egrep(1), or fgrep(1). SEE ALSO
grep(1), xz(1), gzip(1), bzip2(1), zgrep(1) Tukaani 2009-07-05 XZGREP(1)