Find the answer to your Linux question:
Results 1 to 6 of 6
hi all why my terminal is printing these.. while running a program. in c. in this am using perl script.i.e FD = popen ("cat .... | grep .... | sed ...
  1. #1
    Linux Newbie
    Join Date
    Feb 2007
    Location
    hyderabad, india
    Posts
    247

    ps -A and sh <defunct>

    hi all
    why my terminal is printing these..
    while running a program. in c. in this am using perl script.i.e
    FD = popen ("cat .... | grep .... | sed 's/^[ \t]*//' | cut -d: -f2 | awk '{print $1}' ", "r");
    ps -A

    14474 pts/1 00:00:00 sh <defunct>
    14648 pts/1 00:00:00 sh <defunct>
    14942 pts/1 00:00:00 sh <defunct>

    how to avoid these.
    is that script causing these..

    thank you in advance
    "Relationships are built on trust and communication"

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Smile

    hi,
    if you don't want any output then you can redirect your commands ouput and error to /dev/null file
    like
    cmd > /dev/null
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  3. #3
    Linux Newbie
    Join Date
    Feb 2007
    Location
    hyderabad, india
    Posts
    247
    Quote Originally Posted by Lakshmipathi View Post
    hi,
    if you don't want any output then you can redirect your commands ouput and error to /dev/null file
    like
    cmd > /dev/null
    i did that.. but no use
    [root@localhost count]# ps -A
    PID TTY TIME CMD
    25056 pts/1 00:00:00 sh <defunct>
    25091 pts/1 00:00:00 sh <defunct>
    25124 pts/1 00:00:00 sh <defunct>
    25157 pts/1 00:00:00 sh <defunct>
    25189 pts/1 00:00:00 sh <defunct>
    25222 pts/1 00:00:00 sh <defunct>
    25254 pts/1 00:00:00 sh <defunct>
    25287 pts/1 00:00:00 sh <defunct>
    25321 pts/1 00:00:00 sh <defunct>
    25354 pts/1 00:00:00 sh <defunct>
    25386 pts/1 00:00:00 sh <defunct>
    25421 pts/1 00:00:00 sh <defunct>
    25453 pts/1 00:00:00 sh <defunct>
    25486 pts/1 00:00:00 sh <defunct>
    25519 pts/1 00:00:00 sh <defunct>
    25545 pts/2 00:00:00 ps
    [root@localhost count]#
    i am runnig my program in one terminal... in this not printing any... like sh <defunct>
    i opened other terminal and checking ps -A. it is showing like this... if i exit my program..
    it will not showing any of these...

    how to avoid these ...

    thank you in advance.
    "Relationships are built on trust and communication"

  4. #4
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    It seems that you have a bug in your program. These processes are zombie processes.
    Provide further information, what would you like to accomplish exactly?
    Post a snippet of your code within code blocks.

    Regards

  5. #5
    Linux Newbie
    Join Date
    Feb 2007
    Location
    hyderabad, india
    Posts
    247
    Quote Originally Posted by Franklin52 View Post
    It seems that you have a bug in your program. These processes are zombie processes.
    Provide further information, what would you like to accomplish exactly?
    Post a snippet of your code within code blocks.

    Regards
    its a daemon process it will excute(FD) continously for every 10 sec.
    so that in ps -A
    it is showing like that...
    but how can i avoid (25056 pts/1 00:00:00 sh <defunct>
    25091 pts/1 00:00:00 sh <defunct>...... these i didnt want to show in ps -A)

    is there any way

    thank you inadvance
    "Relationships are built on trust and communication"

  6. #6
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Smile

    i think u are creating background process for every 10 sec...if so , then i don't think you can hide them from ps -a ....if you don't want any process then you can kill them.
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...