Hey You weren't pedantic at all I needed the explanation 'cause I don't like to make things I don't understand so now I will add the code to mine
Thanks Alberto <html><div><IMG height=12 src="http://graphics.hotmail.com/emvamp.gif" width=12> Gaucho</div></html> >From: "Michael P. Reilly" <[EMAIL PROTECTED]> >Reply-To: "Michael P. Reilly" <[EMAIL PROTECTED]> >To: Alberto Troiano <[EMAIL PROTECTED]> >Subject: Re: [Tutor] Process problem >Date: Thu, 16 Jun 2005 10:40:09 -0400 > >On 6/16/05, Alberto Troiano <[EMAIL PROTECTED]> wrote: > > > > Hey > > > > What its that for? > > > > can you explain me what it does? and the way to implementing it here: > > os.system("python2.2 /root/levantamuertos.py &") > > and what headaches are you talking about? > > > >Hi, > >The 'nohup' command is to make sure that the child process sticks around >after the parent (and grandparents) have died. > >When a process creates a child, the child is tied to the parent and when >the >parent exits, all the child processes get sent a specific signal (with >os.kill()) telling them that the parent has died. The default procedure >when >they receive this signal is to exit. > >A little history: back in the days of only modems, you would dial into a >UNIX mainframe from a terminal and if the modem disconnected, the system >(or >you) would not want all your processes hanging around afterward. For this >reason, the UNIX system would send a "hangup" signal (SIGHUP) to the login >shell and all its child processes. Shells added a "nohup" (no hangup) >command so certain processes could survive if the user wanted. > >When you say "nohup" it tells the process to ignore the default procedure >and to ignore the SIGHUP (hangup signal). It does not put the process in >the >background so you still need the "&" and it does not change stdout and >stderr (that is why I put those in my e-mail too). > >In python, you would just say: >os.system("nohup python2.2 /root/levantamuertos.py >/dev/null 2>&1 &") > >This should handle most headaches. The headaches that I mentioned are going >to be very subtle. > > 1. One is that sometimes developers have changed shells without > telling users. It has happened in the past that "&" has had an implicit > "nohup" in one version of a shell and in the next release, the implict > "nohup" is no longer there. It is better to be explicit and clear... it >also > helps readability. > 2. A second headache comes from the output streams (stdout and > stderr). You want to be running a number of these >levantamuertos.pyprocess at the same time. Did you know that the >output of your cron job is > captured and e-mailed to you? And by default, the output of child >processes > (levantamuertos.py) would be the same as cron job, usually only on > error? So you might get a lot of mixed output from the different > levantamuertos.py processes running at the same time. If you send all > the output to /dev/null. Or to specific log files (based on PID), then >you > may not have this headache. > >I hope this helps and wasn't too pedantic. I get that way sometimes. >-Arcege >-- >There's so many different worlds, >So many different suns. >And we have just one world, >But we live in different ones. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor