SUMMARY: Backround process dies

From: Gurugunti, Mahesh <MGurugunti_at_us.nomura.com>
Date: Wed Feb 11 2004 - 16:46:07 EST
My Question was

Hi,
> 
> One of our developers has written a simple shell script which monitors
> (greps)  a process and if this monitored process does not exist, it starts
> it. 
> 
> This script is run as a user  as a backround job (script &) from a command
> line and then the user logs out.
> 
> This script dies intermittently, and he wants to know the
reasons/conditions
> on which this monitoring job dies.


The responses I received are below, Thanks for the responses folks.


Hi Guy,

try to run the process with the command nohup.

It detach process from the terminal, so, the user can logout its session
without killing background processes.

Bye.
Fabio Cannone

Hi Mahesh,
every script which shouldn't terminate upon termination of the shell
process it was invoked from, needs to be started with nohup (see man
nohup for details), this is independent from the script itself.
For the script, you (or your developer)  might want to look into using
pgrep.
Barbara

The usual reasons are..

1) Receives a signal (like HUP) that it does not handle.
2) Attempts to write data to a filedesriptor (like STDOUT) that is no
   longer connected to anything (would happen if someone logged out of a
   terminal.) 
3) Attempts to read data from a filedescriptor that is no longer
   attached to anything.

Nohup tends to solve problems with #1 and #2.  Redirecting input from
/dev/null tends to solve #3.


And a bunch of "Out of Office"  auto responses.



-----  This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. If
you receive this message in error, please delete it and all copies from your
system, destroy any hard copies and notify the sender. You must not,
directly or indirectly, use, disclose, distribute, print, or copy any part
of this message if you are not the intended recipient. Nomura Holding
America Inc., Nomura Securities International, Inc, and their respective
subsidiaries each reserve the right to monitor all e-mail communications
through its networks. Any views expressed in this message are those of the
individual sender, except where the message states otherwise and the sender
is authorized to state the views of such entity. Unless otherwise stated,
any pricing information in this message is indicative only, is subject to
change and does not constitute an offer to deal at any price quoted. Any
reference to the terms of executed transactions should be treated as
preliminary only and subject to our formal written confirmation.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Feb 11 16:46:04 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:28 EST