Re: Sleep defunct

2003-02-03 Thread Bob Proulx
Pavan Kumar Purohit wrote:
 thanks for the mail. I experiance the same problem in /bin/bash

Oh well.  A good crosscheck regardless.

 The Shell code is very simple. I excute the program binary and sleep for
 180 seconds in an infinate loop(while(1)).

Something like this?

  while true; do
run-some-program
sleep 180
  done

There is no reason to see a defunct process with a loop such as that.

 Do you think that is is due to swap space (since there is no I/O request)
 that the process is killed.

If so then you should see some indication that you are running out of
virtual memory.

 One observation I made is if I increase the sleep duration the program
 runs for a longer time.

Are you running the command in the background?  If you run background
tasks then you need to wait for them.  Read the shell documentation on
the 'wait' command for more details.

 I am sort of newbee. and I am sorry if I am wasting your time.
 Is there an alternate command for sleep in shell?.

No, 'sleep' is a good command for that.

Bob


___
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils



Re: Sleep defunct

2003-01-30 Thread Pavan Kumar Purohit
Hello Bob,
thanks for the mail. I experiance the same problem in /bin/bash
The Shell code is very simple. I excute the program binary and sleep for
180 seconds in an infinate loop(while(1)).

Do you think that is is due to swap space (since there is no I/O request)
that the process is killed.
One observation I made is if I increase the sleep duration the program
runs for a longer time.

I am sort of newbee. and I am sorry if I am wasting your time.
Is there an alternate command for sleep in shell?.
thanks
regards
pavan


On Wed, 29 Jan 2003, Bob Proulx wrote:

 Pavan Kumar Purohit wrote:
  I have used 'sleep' in a C shell script. This script in turn executes a
  program. sleep is used to give delay between execution of the program in
  the script.
  Every 2-3 hours the sleep becomes defunct (see below)
  root21624  0.0  0.0 00 pts/4Z01:02   0:00 [sleep defunct]
  root21623  0.0  0.0  13084 pts/4T01:02   0:00 sleep 180
  
  As a result the program is not executed.
  Do u suggest anything.
 
 Defunct processes are processes whose parent has not waited on them.
 They are dead.  But they have not gone away.  They are called zombies.
 The sleep program slept, then exited.  But the parent script has a
 problem and is not cleaning up after its children.
 
 The system needs to transfer the return code from the child process to
 the parent.  Until the parent asks for the return code the system
 cannot release the process slot used by the defunct process.  If the
 parent exits then all children of that process will be inherited by
 the init process, pid #1.  One of the jobs of the init process is to
 clean up after these children.
 
 Since your process has become defunct that means the script that ran
 it has a problem and not sleep.  Look at the 'ps -efH | less' listing
 and see the parent process.  Inspect the script around it and see what
 is happening there.  If you kill the parent process the defunct
 children will be cleaned up by init.
 
 Also, you mentioned that you were using csh.  That program is not
 considered very robust for scripts.  Without even looking I feel
 certain the problem is in your /bin/csh binary.  Consider programming
 in /bin/sh instead.
 
 Bob
 




___
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils



Re: Sleep defunct

2003-01-29 Thread Bob Proulx
Pavan Kumar Purohit wrote:
 I have used 'sleep' in a C shell script. This script in turn executes a
 program. sleep is used to give delay between execution of the program in
 the script.
 Every 2-3 hours the sleep becomes defunct (see below)
 root21624  0.0  0.0 00 pts/4Z01:02   0:00 [sleep defunct]
 root21623  0.0  0.0  13084 pts/4T01:02   0:00 sleep 180
 
 As a result the program is not executed.
 Do u suggest anything.

Defunct processes are processes whose parent has not waited on them.
They are dead.  But they have not gone away.  They are called zombies.
The sleep program slept, then exited.  But the parent script has a
problem and is not cleaning up after its children.

The system needs to transfer the return code from the child process to
the parent.  Until the parent asks for the return code the system
cannot release the process slot used by the defunct process.  If the
parent exits then all children of that process will be inherited by
the init process, pid #1.  One of the jobs of the init process is to
clean up after these children.

Since your process has become defunct that means the script that ran
it has a problem and not sleep.  Look at the 'ps -efH | less' listing
and see the parent process.  Inspect the script around it and see what
is happening there.  If you kill the parent process the defunct
children will be cleaned up by init.

Also, you mentioned that you were using csh.  That program is not
considered very robust for scripts.  Without even looking I feel
certain the problem is in your /bin/csh binary.  Consider programming
in /bin/sh instead.

Bob


___
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils