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
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.