All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan <bryanh@supportteam.net>
To: Karthik Vishwanath <karthikv@Alum.Dartmouth.ORG>
Cc: linux-newbie@vger.kernel.org
Subject: Re: remote job execution via xterm
Date: Sat, 03 Sep 2005 22:50:21 -0500	[thread overview]
Message-ID: <431A6EFD.7040602@supportteam.net> (raw)
In-Reply-To: <Pine.LNX.4.44.0509032209490.11321-100000@treebeard.engin.umich.edu>

Karthik Vishwanath wrote:

>Hello,
>
>In order to run some (standard C) code on several machines, I log into a
>machine remotely (via ssh), run the executable, hit Ctrl-Z (in the xterm),
>and set the job into the background with bg (All of this is done from a an
>xterm running bash, locally, and getting a bash shell on the remote
>machines as well; all machines involved were running one or another
>flavor of Linux.)
>
>The trouble is that when I log out of the remote machine (via CTRL-D) I do
>not return to the local prompt on the xterm. I get no display and no
>response to any key strokes (including CTRL-C etc.) If close the xterm
>window (from within X, locally) the job on the remote machines gets
>terminated. The only way to ensure that the remote job stays alive is by
>ssh'ing into the remote machine and killing a lone ssh PID that spawned
>the executable.
>
>A sample session output is pasted below: 
>-----------
>[karthik @mithrandir ~]$ ssh karthikv@edinburgh
>
>[karthikv @edinburgh Dumps]$ ./trmc_2fls_core RTV-POPOP-tissue2.tissue > 
>RTV-POPOP-tissue2.out  (CTRL-Z)
>[1]+  Stopped                 ./trmc_2fls_core RTV-POPOP-tissue2.tissue 
>  
>
>>RTV-POPOP-tissue2.out
>>    
>>
>
>[karthikv @edinburgh Dumps]$ bg
>[1]+ ./trmc_2fls_core RTV-POPOP-tissue2.tissue >RTV-POPOP-tissue2.out &
>
>[karthikv @edinburgh Dumps]$ pstree -ap karthikv
>sshd,8548
>  `-bash,8549
>      |-pstree,8620 -ap karthikv
>      `-trmc_2fls_core,8619 RTV-POPOP-tissue2.tissue
>
>--------> after a CTRL-D here, the terminal is hung as mentioned earlier. 
>>From a new xterm then, again: 
>
>[karthik @mithrandir ~]$ ssh karthikv@edinburgh
>
>[karthikv @edinburgh Dumps]$ pstree -ap karthikv
>sshd,8548
>
>sshd,8679
>  `-bash,8680
>      `-pstree,8710 -ap karthikv
>
>trmc_2fls_core,8619 RTV-POPOP-tissue2.tissue
>
>---------> here a kill -9 8548 keeps the job (8619) alive and brings the 
>original xterm back to the local prompt. 
>
>
>What is going on? How can I ensure that ssh terminates and disconnects 
>from the session without me having to do all of the above and making sure 
>that the executable stays alive? 
>
>
>Thanks and regards,
>
>-K
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.linux-learn.org/faqs
>
>  
>
Hello,

I think it is possible you are leaving this process in your job list. 
Bash has a way of keeping track of all your jobs. Type "jobs" at the 
command prompt and you will see this list. When you log off, every job 
gets a hangup signal which kills the job.

You can take a process out of your job list with the disown command. 
That way, it won't get the hangup signal when you log off.

There are other ways to do this, but here is what I think you should do:

$ ./your_program &
$ disown
$ logout

For more information, you can do man bash and search for "disown", 
"jobs", "bg", and "fg".

Best Regards,
Bryan H.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2005-09-04  3:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-04  2:37 remote job execution via xterm Karthik Vishwanath
2005-09-04  3:50 ` Bryan [this message]
2005-09-04 13:51 ` Tobias Hirning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=431A6EFD.7040602@supportteam.net \
    --to=bryanh@supportteam.net \
    --cc=karthikv@Alum.Dartmouth.ORG \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.