By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

services

P: n/a
I have a python script (file start with #!/usr/bin/python) that use
xmlrpclib to lessen and respond on port:8000. The problem is when I
close the shell (bash in remote with putty) the script stop to work. I
try to start it in backgroud with & but it dosent work. Finally I copy
and I try to modify the /etc/init.d/crond to start the script in
services (with start-stop-demon but I have the same problem... When I
close putty the script stop.

Someone have a idea?

thank's

Laurent
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Laurent Vincelette wrote:
I have a python script (file start with #!/usr/bin/python) that use
xmlrpclib to lessen and respond on port:8000. The problem is when I
close the shell (bash in remote with putty) the script stop to work. I
try to start it in backgroud with & but it dosent work. Finally I copy
and I try to modify the /etc/init.d/crond to start the script in
services (with start-stop-demon but I have the same problem... When I
close putty the script stop.

Someone have a idea?


Redirect stdout and stderr to /dev/null. I'm not sure which of these --
perhaps both -- is necessary, but doing both certainly works...

That is, this should work:

yourscript.py >/dev/null 2>/dev/null &

-Peter
Jul 18 '05 #2

P: n/a
* Laurent Vincelette <lv*********@videotron.ca> [2004-03-18 19:53]:
I have a python script (file start with #!/usr/bin/python) that use
xmlrpclib to lessen and respond on port:8000. The problem is when I
close the shell (bash in remote with putty) the script stop to work. I
try to start it in backgroud with & but it dosent work. Finally I copy
and I try to modify the /etc/init.d/crond to start the script in
services (with start-stop-demon but I have the same problem... When I
close putty the script stop.

Someone have a idea?


try:

% nohup file.py &

It redirects the output (and stderr) to ./nohup.out, and prevents the
HUP signal from being sent to the process when you log out.

And if you want the service to run at startup, I'd probably create a
separate startup script (if it's running as a permament service, I don't
think cron has anything to do with it) which launches it and redirects
the output.

-John

<my first name> at hazen.net

Jul 18 '05 #3

P: n/a
John Hazen wrote:
try:

% nohup file.py &

It redirects the output (and stderr) to ./nohup.out, and prevents the
HUP signal from being sent to the process when you log out.


Interesting!

Note, from "info nohup", that it reduces the process' priority (i.e.
increases the priority value by 5), and can in some cases not actually
run the command at all.

Still, another interesting tidbit for the toolbox.

-Peter
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.