Running matlab in the background

后端 未结 6 739
北恋
北恋 2021-02-04 17:25

I am running matlab on 48 virtual machines and would like to automate it. I ssh into the machines then use matlab -r matlab_command > outfile.txt & to get t

6条回答
  •  悲&欢浪女
    2021-02-04 17:52

    I had trouble with screen: matlab started but had no notion of what had been passed through stdin. It simply ignored it.

    But I succeeded with tmux. Here is the command line I used,

    local$ ssh -f me@remote 'tmux new-session -d -s matlab "matlab -nojvm -nodesktop -nodisplay -nosplash 

    You can then ssh into the remote host (indicated here by the prefix remote$) and check things by issuing remote$ tmux a -t matlab. You detach out to your remote host by pressing Ctrl-b d. You list sessions with remote$ tmux ls (like screen). You kill the session from inside with Ctrl-b & and from outside with $remote tmux kill-session -t matlab.

    But I discovered that you can also attach to your tmux session from your local host directly:

    local$ ssh -t me@remote 'tmux a -t matlab'
    

    Notice I had to use -t here in place of -f.

提交回复
热议问题