[Top][All Lists]
[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
From: |
OSK Lu Jun |
Subject: |
bug report in command ( ps -ef | grep "myTask" | grep -v "grep" | wc -l ) |
Date: |
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
Oracle9iR2.
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
Japanese Version
CPU: Intel Xeon 3.06GHz (1 CPU System)
RAM: 1.5G
Compiler: g++, Oracle ProC
Problem description:
There are 7 executable programs and 1 process-check bash program in my
server
application. When the application start up, these executable programs will
be loaded
and stationed in the RAM. I use the process-check bash program to check if
they
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.
chkprocess() {
PROCESS_NUM=`ps -ef | grep "myTask" | grep -v "grep" | wc -l`
if [ $PROCESS_NUM -eq 0 ]; then
return $NON_EXIST
else
return $EXIST
fi
}
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
healthily.
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
there
are other ways to judge a specified program's alive status. I am looking
forward
your replys.
Sincerely yours,
Lu,Jun
- bug report in command ( ps -ef | grep "myTask" | grep -v "grep" | wc -l ),
OSK Lu Jun <=