[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug report in command ( ps -ef | grep "myTask" | grep -v "grep" | wc -l
OSK Lu Jun
bug report in command ( ps -ef | grep "myTask" | grep -v "grep" | wc -l )
Fri, 25 Feb 2005 07:26:20 -0000
To whom it may concern
I am developing a server application on Linux AS2.1(Japanese Version) with
Now I meet a very strange problem that I can not solve. I think maybe it is
a bug of Linux.
So I make a report to someone who is Linux professional here.
The details of the problem as follows,
OS: Redhat Linux Advanced Server release 2.1AS(Pensacola) 2.4.9-e.3smp
CPU: Intel Xeon 3.06GHz (1 CPU System)
Compiler: g++, Oracle ProC
There are 7 executable programs and 1 process-check bash program in my
application. When the application start up, these executable programs will
and stationed in the RAM. I use the process-check bash program to check if
are alive. In bash file I use the COMMAND
( PROCESS_NUM=`ps -ef | grep "myTask" | grep -v "grep" | wc -l` )
to judge the alive status of my executable programs.
PROCESS_NUM=`ps -ef | grep "myTask" | grep -v "grep" | wc -l`
if [ $PROCESS_NUM -eq 0 ]; then
But I get a stange result in my system. Sometimes the return value of
PROCESS_NUM is 0, sometimes the return value of PROCESS_NUM is
not 0. After it happened, I check my program in B-shell by 'ps x', the
result show that my programs are still alive, and then I check my program's
log file. It also show my task programs have not been dead, still alive
There are no restart functions in my programs. I have let my programs
continue running 24 hours, this problem will happen 1 or 2 times in a day.
So I think the COMMAND in my bash file may have a bug. And I wonder if
are other ways to judge a specified program's alive status. I am looking
- bug report in command ( ps -ef | grep "myTask" | grep -v "grep" | wc -l ),
OSK Lu Jun <=