2

I would like to run a long simulation (24 hours) in MATLAB installed on a remote linux machine, using xterm.

I have no problems connecting to the remote machine from my Macbook, and launching MATLAB using xterm.

The problem I have is that my Macbook needs to be physically on, in order for MATLAB to stay open in xterm and continue the simulation. However, I would like to go to sleep whilst the simulation executes, and turn off the laptop.

In the past, I have used screen with success, to detach and then later return to command-line programs running long simulations. However, I cannot see how to use this with xterm.

2 Answers 2

0

Unfortunately this is not possible with xterm. When xterm quits (or gets disconnected), the process will lose access to the TTY and will shutdown or disappear into the background. You would not be able to connect to it after reconnecting.

You would need a terminal multiplexer like screen or tmux to handle the TTY I/O on the remote server when your client is disconnected.

1

Thanks for the reply, mtak.

I worked around this problem by using screen and executing MATLAB at the command prompt:

$ screen
$ /path/to/matlab/bin/matlab -nodisplay -nosplash -nodesktop -r "run('/path/to/code/mycode.m');exit;"

Then ctrl-a-d to detach the terminal. Leave the simulation running and go to sleep etc. Come back after many hours, xterm into the remote machine, and

$ screen -r

at the terminal, to check progress.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .