AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
Expand all | Collapse all

ps returns 2 instances for a process name while there is actually 1

  • 1.  ps returns 2 instances for a process name while there is actually 1

    Posted Tue June 20, 2006 06:32 AM

    Originally posted by: SystemAdmin


    Hi
    In a script I am checking for the number of processes with the name of the script to avoid multiple instances .. so the script name is runMonitor.sh and as soon as it is invoked, it checks for
    ps -ef | grep runMonitor | grep -v grep | wc -l

    this returns 2 and so we are trying to list it by
    ps -ef | grep runMonitor | grep -v grep

    which displays only the current process .. this confuses the script and so it exits without proceeding (as per the code)..
    Please can you let me know why this is happening ? Is it a AIX problem ?


  • 2.  the devil is in the detail

    Posted Thu June 22, 2006 06:27 AM

    Originally posted by: nagger


    I think you need to show us the actual script you are running.
    You have simplified it for the question here and removed the problem.
    And how are you starting the script?

    You do reelise "ps" shows processes and it is the ksh process that is running your script - this can confuse things.

    The chances of his being an AIX bug are remote.
    If its a bug then there will be thousands of production machines in trouble!