comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Batch mode and ssh...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Batch mode and ssh... [message #71765] Thu, 22 July 2010 06:50
Dave[5] is currently offline  Dave[5]
Messages: 11
Registered: July 2010
Junior Member
On Jul 22, 3:07 pm, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Thu, 22 Jul 2010, Dave wrote:
>> I detach this screen, and then attempt to logout of the remote
>> machine.  Logout hangs, and I kill it using ctrl-C.  This breaks my
>> IDL script, and the logfile tells me why:
>> X connection to localhost:19.0 broken (explicit kill or server
>> shutdown).
>
>> So it definitely has something to do with the X server.  Even if I'm
>> running IDL inside a screen on the remote machine, the X server is
>> still being run on my local laptop.  I confess, this level of window
>> management/X servers is a little beyond my level of computer
>> knowledge.  I don't know how to make the X server be hosted by the
>> remote computer.
>
> The graphical counterpart of screen is Xvnc (vncserver). I use it with
> openSUSE 11.2, but I think other distros are similar:
>
> - login to the remote host
> - vncserver
>      this prints something like:
>      ...
>      New 'X' desktop is remote:1
>      ...
> - logout
>
> On your local machine:
>
> - vncviewer remote:1
> - open a terminal, start your job, ...
>
> After exiting vncviewer, you can turn off your local machine.
>
> regards,
> lajos

SUCCESS! Thanks so much for your help. I used a slightly different
order than you suggested, but it worked, and my script is now
running. And with the X server being on the same machine as the
actual script, it's running MUCH faster than before. It looks to be
on pace to finish in ~2 hours instead of ~2 days.

My method was:
log in to remote machine
start vncserver
logout
log back in (I couldn't get my local vncviewer to find the remote
server)
start vncviewer
open a screen within the vncviewer
run script
detach the screen
close the vncviewer
logout of remote machine
script is still running

I'm not sure if all that is strictly necessary, especially the screen
within the vncviewer, but it works, and that is my primary concern.
I'll worry about elegance later.

Dave
Re: Batch mode and ssh... [message #71768 is a reply to message #71765] Thu, 22 July 2010 06:07 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Thu, 22 Jul 2010, Dave wrote:

> I detach this screen, and then attempt to logout of the remote
> machine. Logout hangs, and I kill it using ctrl-C. This breaks my
> IDL script, and the logfile tells me why:
> X connection to localhost:19.0 broken (explicit kill or server
> shutdown).
>
> So it definitely has something to do with the X server. Even if I'm
> running IDL inside a screen on the remote machine, the X server is
> still being run on my local laptop. I confess, this level of window
> management/X servers is a little beyond my level of computer
> knowledge. I don't know how to make the X server be hosted by the
> remote computer.

The graphical counterpart of screen is Xvnc (vncserver). I use it with
openSUSE 11.2, but I think other distros are similar:

- login to the remote host
- vncserver
this prints something like:
...
New 'X' desktop is remote:1
...
- logout

On your local machine:

- vncviewer remote:1
- open a terminal, start your job, ...

After exiting vncviewer, you can turn off your local machine.

regards,
lajos
Re: Batch mode and ssh... [message #71769 is a reply to message #71768] Thu, 22 July 2010 05:47 Go to previous message
Dave[5] is currently offline  Dave[5]
Messages: 11
Registered: July 2010
Junior Member
On Jul 22, 2:40 pm, Dave <riebe...@gmail.com> wrote:
> On Jul 22, 2:21 pm, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
>
>> On Thu, 22 Jul 2010, Dave wrote:
>>> Ah.  I'm still having trouble logging out of the remote host.  I
>>> detach the screen, but logout still hangs.  :/  Any ideas?
>
>> What does 'ps -flu your_user_name' show before logout?
>
>> Pressing Ctrl-C (or killing the ssh command from an other window) helps
>> sometime. Try it and then login again to check your job's status.
>
>> regards,
>> lajos
>
> As Paulo mentions, I think it has something to do with the X server.
> Ps -flu immediately before logout gives me:
>
> driebel mars 23> ps -flu driebel
> F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY
> TIME CMD
> 5 S driebel  26861 26857  0  75   0 - 22568 stext  07:38 ?
> 00:00:00 sshd: driebel@notty
> 0 S driebel  26862 26861  0  85   0 - 17676 rt_sig 07:38 ?
> 00:00:00 tcsh -c /usr/libexec/openssh/sftp-server
> 0 S driebel  26914 26862  0  75   0 - 14031 -      07:38 ?
> 00:00:00 /usr/libexec/openssh/sftp-server
> 1 S driebel  28872     1  0  76   0 -  6444 stext  07:55 ?
> 00:00:00 SCREEN
> 0 S driebel  28873 28872  0  75   0 -  2387 -      07:55 pts/38
> 00:00:00 -usr/bin/tcsh
> 5 S driebel  30715 30711  0  75   0 - 22735 stext  08:36 ?
> 00:00:00 sshd: driebel@pts/16
> 0 S driebel  30738 30715  0  75   0 - 17744 rt_sig 08:36 pts/16
> 00:00:00 -tcsh
> 1 S driebel  30813     1  0  76   0 -  6444 stext  08:37 ?
> 00:00:00 SCREEN
> 0 S driebel  30814 30813  0  76   0 -  2387 -      08:37 pts/41
> 00:00:00 -usr/bin/tcsh
> 0 S driebel  30862 30814 28  79   4 - 84446 643279 08:37 pts/41
> 00:00:07 /opt/rsi/idl/bin/bin.linux.x86_64/idl script_test
> 0 R driebel  30907 30738  0  76   0 -  3674 -      08:38 pts/16
> 00:00:00 ps -flu driebel
> driebel mars 24>
>
> Previously, ctrl-c has indeed unhung logout, but doing so kills the
> remote IDL script.

More info:
I am directing output to a logfile using:
nohup nice /opt/rsi/idl/bin/idl batch_script >& log &

I detach this screen, and then attempt to logout of the remote
machine. Logout hangs, and I kill it using ctrl-C. This breaks my
IDL script, and the logfile tells me why:
X connection to localhost:19.0 broken (explicit kill or server
shutdown).

So it definitely has something to do with the X server. Even if I'm
running IDL inside a screen on the remote machine, the X server is
still being run on my local laptop. I confess, this level of window
management/X servers is a little beyond my level of computer
knowledge. I don't know how to make the X server be hosted by the
remote computer.

Dave
Re: Batch mode and ssh... [message #71770 is a reply to message #71769] Thu, 22 July 2010 05:40 Go to previous message
Dave[5] is currently offline  Dave[5]
Messages: 11
Registered: July 2010
Junior Member
On Jul 22, 2:21 pm, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Thu, 22 Jul 2010, Dave wrote:
>> Ah.  I'm still having trouble logging out of the remote host.  I
>> detach the screen, but logout still hangs.  :/  Any ideas?
>
> What does 'ps -flu your_user_name' show before logout?
>
> Pressing Ctrl-C (or killing the ssh command from an other window) helps
> sometime. Try it and then login again to check your job's status.
>
> regards,
> lajos

As Paulo mentions, I think it has something to do with the X server.
Ps -flu immediately before logout gives me:


driebel mars 23> ps -flu driebel
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY
TIME CMD
5 S driebel 26861 26857 0 75 0 - 22568 stext 07:38 ?
00:00:00 sshd: driebel@notty
0 S driebel 26862 26861 0 85 0 - 17676 rt_sig 07:38 ?
00:00:00 tcsh -c /usr/libexec/openssh/sftp-server
0 S driebel 26914 26862 0 75 0 - 14031 - 07:38 ?
00:00:00 /usr/libexec/openssh/sftp-server
1 S driebel 28872 1 0 76 0 - 6444 stext 07:55 ?
00:00:00 SCREEN
0 S driebel 28873 28872 0 75 0 - 2387 - 07:55 pts/38
00:00:00 -usr/bin/tcsh
5 S driebel 30715 30711 0 75 0 - 22735 stext 08:36 ?
00:00:00 sshd: driebel@pts/16
0 S driebel 30738 30715 0 75 0 - 17744 rt_sig 08:36 pts/16
00:00:00 -tcsh
1 S driebel 30813 1 0 76 0 - 6444 stext 08:37 ?
00:00:00 SCREEN
0 S driebel 30814 30813 0 76 0 - 2387 - 08:37 pts/41
00:00:00 -usr/bin/tcsh
0 S driebel 30862 30814 28 79 4 - 84446 643279 08:37 pts/41
00:00:07 /opt/rsi/idl/bin/bin.linux.x86_64/idl script_test
0 R driebel 30907 30738 0 76 0 - 3674 - 08:38 pts/16
00:00:00 ps -flu driebel
driebel mars 24>

Previously, ctrl-c has indeed unhung logout, but doing so kills the
remote IDL script.
Re: Batch mode and ssh... [message #71772 is a reply to message #71770] Thu, 22 July 2010 05:21 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Thu, 22 Jul 2010, Dave wrote:

> Ah. I'm still having trouble logging out of the remote host. I
> detach the screen, but logout still hangs. :/ Any ideas?
>

What does 'ps -flu your_user_name' show before logout?

Pressing Ctrl-C (or killing the ssh command from an other window) helps
sometime. Try it and then login again to check your job's status.

regards,
lajos
Re: Batch mode and ssh... [message #71773 is a reply to message #71772] Thu, 22 July 2010 05:16 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jul 22, 8:45 am, Dave <riebe...@gmail.com> wrote:

>
> Ah.  I'm still having trouble logging out of the remote host.  I
> detach the screen, but logout still hangs.  :/  Any ideas?

I have seen it happen when an X program was called from the ssh
session. A ctrl-c ends the hung logout. If all else fails, you can
kill the ssh process.

I have had screen sessions running for months, with dozens of
connection cycles. When I am shutting down my laptop I usually do not
even bother to detach and exit the ssh. On reconnect, screen can be
given the -d switch, to detach the screen from the previous terminal,
if it is still attached. Which is another use of screen, to keep the
session in the event of a lost network connection.

On a different point, have you checked that your original problem was
not due to the input? That is, would

nohup nice /opt/rsi/idl/bin/idl batch_script >& log &

work?
Re: Batch mode and ssh... [message #71775 is a reply to message #71773] Thu, 22 July 2010 04:45 Go to previous message
Dave[5] is currently offline  Dave[5]
Messages: 11
Registered: July 2010
Junior Member
On Jul 22, 1:37 pm, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Thu, 22 Jul 2010, Dave wrote:
>> Wow, thanks, lajos.  I'm experimenting with screen to see how it
>> works.
>> I notice that if I ask screen for the processes it's detached from
>> (using screen -list) I see a list of processes that seem to be on my
>> local machine, even though they are executing on the remote system.
>> Perhaps it's a stupid question, but turning my local system off
>> wouldn't kill the execution I started remotely, would it?  It's not
>> "dependent" on the local process still?
>
>> Dave
>
> screen must be started on the remote machine:
>
> - login to remote host
> - start screen
> - start your job
> - detach (Ctrl-A d)
> - logout from remote host
>
> You'll have no local process connected with your job, you can turn off
> your local machine. Then later:
>
> - login to remote host
> - reattach (screen -r)
>
> regards,
> lajos

Ah. I'm still having trouble logging out of the remote host. I
detach the screen, but logout still hangs. :/ Any ideas?
Re: Batch mode and ssh... [message #71776 is a reply to message #71775] Thu, 22 July 2010 04:37 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Thu, 22 Jul 2010, Dave wrote:

> Wow, thanks, lajos. I'm experimenting with screen to see how it
> works.
> I notice that if I ask screen for the processes it's detached from
> (using screen -list) I see a list of processes that seem to be on my
> local machine, even though they are executing on the remote system.
> Perhaps it's a stupid question, but turning my local system off
> wouldn't kill the execution I started remotely, would it? It's not
> "dependent" on the local process still?
>
> Dave

screen must be started on the remote machine:

- login to remote host
- start screen
- start your job
- detach (Ctrl-A d)
- logout from remote host

You'll have no local process connected with your job, you can turn off
your local machine. Then later:

- login to remote host
- reattach (screen -r)

regards,
lajos
Re: Batch mode and ssh... [message #71777 is a reply to message #71776] Thu, 22 July 2010 04:22 Go to previous message
Dave[5] is currently offline  Dave[5]
Messages: 11
Registered: July 2010
Junior Member
Wow, thanks, lajos. I'm experimenting with screen to see how it
works.
I notice that if I ask screen for the processes it's detached from
(using screen -list) I see a list of processes that seem to be on my
local machine, even though they are executing on the remote system.
Perhaps it's a stupid question, but turning my local system off
wouldn't kill the execution I started remotely, would it? It's not
"dependent" on the local process still?

Dave


On Jul 22, 11:48 am, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Thu, 22 Jul 2010, Dave wrote:
>> I need to execute an idl script that will take ~2 days to run.  I'd
>> like to run this on a remote system I SSH into in batch mode so that I
>> can log off and use my local machine for other things.  However, I
>> cannot seem to both log off and get useful output from my script.  My
>> first attempt was to write a batch mode script containing
>> (find_model_orich is the lengthy program):
>
>> .compile /home/driebel/IDL/Astro_lib/pro/readcol.pro
>> .compile find_model_orich
>> find_model_orich,/graph
>> retall
>> exit
>
>> I then executed this from the command line using:
>
>> nohup nice /opt/rsi/idl/bin/idl < batch_script >& log &
>
>> This does execute the program correctly in the background, but I
>> cannot logout of the terminal without killing the execution.  Thus, my
>> laptop is stuck at work, holding open a terminal.  The internet
>> advised me that this was because of the way SSH interacts with
>> background scripts and to try redirecting the output:
>
>> nohup nice /opt/rsi/idl/bin/idl batch_script >& /dev/null &
>
>> Indeed, I can now logout of the terminal, but ALL my output, such as
>> the various graphs and text files my routine should generate (and I
>> want, of course), get sent to /dev/null.  Is there are way to get IDL
>> batch mode to still output my graphs in the background, but to let me
>> close my SSH session to the remote machine?  Thanks,
>> Dave
>
> I use GNU screen (http://www.gnu.org/software/screen/) for long runs.
> You can deattach the terminal and logout, then login later again and
> reattach it.
>
> regards,
> lajos
Re: Batch mode and ssh... [message #71780 is a reply to message #71777] Thu, 22 July 2010 02:48 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Thu, 22 Jul 2010, Dave wrote:

> I need to execute an idl script that will take ~2 days to run. I'd
> like to run this on a remote system I SSH into in batch mode so that I
> can log off and use my local machine for other things. However, I
> cannot seem to both log off and get useful output from my script. My
> first attempt was to write a batch mode script containing
> (find_model_orich is the lengthy program):
>
> .compile /home/driebel/IDL/Astro_lib/pro/readcol.pro
> .compile find_model_orich
> find_model_orich,/graph
> retall
> exit
>
> I then executed this from the command line using:
>
> nohup nice /opt/rsi/idl/bin/idl < batch_script >& log &
>
> This does execute the program correctly in the background, but I
> cannot logout of the terminal without killing the execution. Thus, my
> laptop is stuck at work, holding open a terminal. The internet
> advised me that this was because of the way SSH interacts with
> background scripts and to try redirecting the output:
>
> nohup nice /opt/rsi/idl/bin/idl batch_script >& /dev/null &
>
> Indeed, I can now logout of the terminal, but ALL my output, such as
> the various graphs and text files my routine should generate (and I
> want, of course), get sent to /dev/null. Is there are way to get IDL
> batch mode to still output my graphs in the background, but to let me
> close my SSH session to the remote machine? Thanks,
> Dave
>

I use GNU screen (http://www.gnu.org/software/screen/) for long runs.
You can deattach the terminal and logout, then login later again and
reattach it.

regards,
lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Simple hack to get $2000 to your home.
Next Topic: Re: Stop and return to caller

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:41:26 PDT 2025

Total time taken to generate the page: 0.00802 seconds