Weblog entry #2 for nathanbullock

Background process causes ssh to hang
Posted by nathanbullock on Thu 1 Mar 2007 at 03:00
Tags: none.
Here is my problem, I have a python script that can take a very long time to run, I want to ssh into my server, run it in the background, exit ssh, and let it finish when ever it finishes. But when I try to exit, ssh always hangs.

I have tried using 'nohup python longjob.py &', setsid, and disown. The same thing always seems to happen.

The closest I can get is to run something like this:
ssh user@server 'nohup python longjob.py &' and then kill it with CTRL-C. The process keeps running on the server... but why do have to do the CTRL-C garbage.

 

Comments on this Entry

Posted by trollll (24.153.xx.xx) on Thu 1 Mar 2007 at 03:55
[ Send Message | View Weblogs ]
Why not use screen? I use it for many other things, but using it to kick off long-running processes (or keep elinks open to my webmail) definitely comes in handy - very easy to detach and reattach sessions.

[ Parent | Reply to this comment ]

Posted by emeitner (216.170.xx.xx) on Thu 1 Mar 2007 at 14:17
[ Send Message | View emeitner's Scratchpad | View Weblogs ]
Maybe try:
ssh user@server 'echo "python longjob.py"|at now' 


[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search