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
The real clean solution to your problem is to use GNU Screen. Then you will not loose your Matlab session and you can always get back into the Matlab prompt. Very helpful if somebody went wrong with your Matlab code and you need to debug a little.
Just fire up 'screen
' (after you have the package installed, included in all major distributions). You will have a typical prompt, but inside a persistent, virtual terminal. Start your matlab as usual, omit any backgrounding. Then press CTRL+A, D (first CTRL+A, then d). You will be out of screen. You can logout. If you want to get back to your screen session, run screen -r
. If you want, you can also directly start screen matlab [...]
in the first place. It will have the effect that your virtual session is also dropped when matlab quits.